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条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料