日期:2014-05-16  浏览次数:20799 次

存储过程转换,急求高手帮助!谢谢!!
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

create PROCEDURE [dbo].[sp_update_cms_contract_nstc_interface]

AS
declare @errorvariable int
BEGIN
  SET XACT_ABORT ON
  BEGIN TRY 
  BEGIN TRAN T1
  --更新零售合同信息
  delete IF_Contract
  insert into IF_Contract
  select * from [10.192.68.177].[EsApp].[dbo].[NSTC_IF_Contract_T]
  COMMIT TRAN T1 
  END TRY 
  BEGIN CATCH
  set @errorvariable=@@ERROR
IF @errorvariable<>0
BEGIN
  ROLLBACK TRAN T1
  RETURN 
END
  END CATCH
END

------解决方案--------------------
create or replace
procedure sp_update_cms
iS
errorvariable number(10) := 0;
begin
delete IF_Contract;
insert into IF_Contract
select * from NSTC_IF_Contract_T;
errorvariable := 0;
COMMIT;
return;
exception when others then
errorvariable := sqlcode;
ROLLBACK;
return;
END sp_update_cms;