如何在Sybase

时间:2015-08-03 08:19:19

标签: locking sybase

我在Sybase中有一个存储过程,它由Java代码逐行插入调用,如何确定此SP是锁定表还是锁定行?要检查基础表属性还是SP本身?

CREATE PROCEDURE dbo.sp1
(@id_code             varchar(10), 
 @position_id         numeric(10,0)  OUTPUT
)
AS
BEGIN
    BEGIN TRANSACTION

    INSERT INTO abc..table1(
            id_code,
            position_id
        )
        values (
            @id_code
            @position_id
        )        
    COMMIT

    SELECT @position_id = @@identity    
END
go
EXEC sp_procxmode 'dbo.sp1', 'unchained'
go
IF OBJECT_ID('dbo.sp1') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.sp1 >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.sp1 >>>'

1 个答案:

答案 0 :(得分:1)

可以使用lockscheme()内置命令确定表的锁定方案。

lockscheme('tableName')

您还可以指定obj_iddbid

ASE 16 Documentation: lockscheme