alter proc skyGetBizKey
V_AddCount int,
V_KeyName Varchar2(128),
V_Retval int Output
As
begin try
begin tran
If Exists(Select IndexValue From skyBizkeys Where BizForm = v_KeyName) Begin
Set v_Retval = (Select top 1 ISNULL(IndexValue, 0) + 1 From skyBizkeys Where BizForm = @KeyName)
if upper(@KeyName) = '$TEMPINSTANCE' and exists(select 1 from skyBizkeys Where BizForm = '$INSTANCE' and IndexValue > @Retval) begin
set @Retval = (select top 1 ISNULL(IndexValue, 0) + 1 from skyBizkeys Where BizForm = '$INSTANCE')
end;
Update skyBizkeys Set IndexValue = @Retval+@AddCount-1 Where BizForm = @KeyName
end;
Else Begin
Insert Into skyBizkeys(BizForm, IndexValue) Values (@KeyName, @AddCount+1)
Set @Retval = 1
end;
用这个试试
sqlserver自动生成sql语句工具sqlserver转oracle
http://download.csdn.net/detail/c03424/5832629