Autonomous transactions in Sybase ASE 15.5

主宰稳场 提交于 2019-12-12 06:57:01

问题


I'm working on Oracle to Sybase ASE SPs conversion and trapped into the autonomous transaction usage in PL/SQL.

Could you please let me know if there is any equivalent for this feature in Sybase Adaptive Server Enterprise? May be there are some relevant posts with the description of the solution for this problem?

Thank you in advance.


回答1:


Never mind. I've managed to find the solution myself.

To whom it may be interested: The idea of the solution has been taken from the SQL Server external SPs, that Microsoft uses as the solution for AUTONOMOUS TRANSACTIONS from Oracle.

In Sybase Adaptive Server Enterprise there is an opportunity to create a Remote Server on your current server using the following statement:

exec sp_addserver SRVName, RPCServer, @@servername

Then it is required to set the option on the current server:

set transactional_rpc on

From this point you're allowed to refer to your objects through the SRVName server, like:

create proc sp_test_autonom1
as
begin
begin transaction
insert into test_idx values(10,20)
declare @status int
exec @status = SRVName.itest..sp_autonom
rollback transaction
end

SRVName.itest..sp_autonom can be created as:

create proc sp_autonom
as
begin 
begin transaction
insert into test_idx2 values(1,2)
commit transaction
end

Tables can be created as:

create table test_idx(col1 int, col2 int)
go
create table test_idx2(col1 int, col2 int)

Thank you.



来源:https://stackoverflow.com/questions/26866521/autonomous-transactions-in-sybase-ase-15-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!