fangjialea 2015-07-28 07:22 采纳率: 100%
浏览 1490
已采纳

sqlserver存储过程转微oracle的存储过程求教,在线等

USE [chss_back]
GO
/****** 对象: StoredProcedure [dbo].[sp_Public_PyWbmGet] 脚本日期: 07/28/2015 10:54:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[sp_Public_PyWbmGet]
@tablename varchar(32),
@fieldname1 varchar(32),
@fieldname2 varchar(32),
@pybz char(1) = '0'
as
set nocount on

exec('declare @name varchar(255),@shortcut varchar(255)'+
' declare cs_py cursor for select '+@fieldname1+','+@fieldname2+
' from '+@tablename+
' where '+@fieldname2+ ' is null'+
' for update of '+@fieldname2+
' open cs_py'+
' fetch cs_py into @name,@shortcut'+
' while @@fetch_status=0'+
' begin exec sp_Public_PyWbm @name,'+@pybz+',@shortcut output'+
' update '+@tablename+' set '+@fieldname2+'=convert(varchar(40),@shortcut)'+
' where current of cs_py'+
' fetch cs_py into @name,@shortcut end'+
' close cs_py deallocate cs_py'
)
GO

  • 写回答

3条回答 默认 最新

  • WorldMobile 2015-07-28 07:34
    关注

    上面太乱了

     1. declare
      2. type empdtlrec is record (empno number(4),
      3. ename varchar2(20),
      4. deptno number(2));
      5. empdtl empdtlrec;
      6. begin
      7. execute immediate ‘select empno, ename, deptno ’ ||
      8. ‘from emp where empno = 7934’
      9. into empdtl;
      10. end;
    

    可参考

    http://blog.csdn.net/xiooix2012/article/details/6895594

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?