首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > IBM DB2 >

存储过程oracle转DB2解决方案

2013-03-26 
存储过程oracle转DB2create or replace procedure ProCheck (v_dealdate in number)isbegindelete from Cs

存储过程oracle转DB2
create or replace procedure ProCheck (v_dealdate in number)is
begin
  delete from CstpCheck where checkdate = v_dealdate;

  insert into CstpCheck select * from (
  select * from (
  select GTMS, Type, Id1, 'M' TradeSouce, to_number(to_char(DealDate, 'YYYYMMDD'))  
  from CstpHis where to_number(to_char(DealDate, 'YYYYMMDD')) = v_dealdate and Trademodel = 'M'

  minus

  select GTMS, Type, Id1, 'M' TradeSouce, to_number(to_char(DealDate, 'YYYYMMDD'))  
  from FXHis where to_number(to_char(DealDate, 'YYYYMMDD')) = v_dealdate and Trademodel = 'M'
)

  union

  select * from (
  select GTMS, Type, Id1, 'M' TradeSouce, to_number(to_char(DealDate, 'YYYYMMDD'))  
  from FXHis where to_number(to_char(DealDate, 'YYYYMMDD')) = v_dealdate and Trademodel = 'M'

  minus

  select GTMS, Type, Id1, 'M' TradeSouce, to_number(to_char(DealDate, 'YYYYMMDD'))  
  from CstpHis where to_number(to_char(DealDate, 'YYYYMMDD')) = v_dealdate and Trademodel = 'M'
  )

  );
  insert into OperLog (OperID,OperDate,Content) values
  (Log_seq.nextval, to_date(v_dealdate, 'YYYY-MM-DD'), '成功');
commit;
exception
  when no_data_found then
  rollback;
  insert into OperLog (OperID,OperDate,Content) values
  (Log_seq.nextval, to_date(v_dealdate, 'YYYY-MM-DD'), '失败');
  commit;
  when others then
  rollback;
  insert into OperLog (OperID,OperDate,Content) values
  (Log_seq.nextval, to_date(v_dealdate, 'YYYY-MM-DD'), '失败');
  commit;
end ProCheck;

如题,转成DB2改如何修改

[解决办法]
1.用db2 mtk可以直接转 不过要求oracle存储过程要写的复合工具的要求

2.把oracle存储过程的函数、数据类型等转成db2的,再调试语法;或者了解功能,自己重写

建议还是自己试试,有问题再发
我的异常网推荐解决方案:oracle存储过程,http://www.myexception.cn/oracle-develop/177537.html

热点排行