Sybase ASE 15.5中的自主事务 [英] Autonomous transactions in Sybase ASE 15.5

查看:76
本文介绍了Sybase ASE 15.5中的自主事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究从Oracle到Sybase ASE SP的转换,并陷入PL/SQL中自主事务的使用中.

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

请让我知道Sybase Adaptive Server Enterprise中是否有与此功能等效的功能?可能有一些相关的帖子描述了该问题的解决方案?

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?

谢谢.

推荐答案

没关系.我设法自己找到了解决方案.

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

它可能对谁感兴趣: 该解决方案的想法来自SQL Server外部SP,Microsoft将其用作Oracle自主交易的解决方案.

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.

在Sybase Adaptive Server Enterprise中,可以使用以下语句在当前服务器上创建远程服务器:

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

从这一点开始,您可以通过SRVName服务器引用对象,例如:

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可以创建为:

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

表的创建方式为:

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

谢谢.

这篇关于Sybase ASE 15.5中的自主事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆