oracle自定义函数迁移到DB2,高手进来帮忙,多谢了

smallMage 2013-08-01 01:36:25
create or replace function GET_SEQ( seq_name in char, o_seq_v out numeric )
return int
AS
t_sqlstr varchar(100);
begin
t_sqlstr := 'select '||seq_name||'.nextval from dual';
--dbms_output.put_line( t_sqlstr );

execute immediate t_sqlstr into o_seq_v;

--select rrn.nextval into o_seq_v from dual;

return(0);
exception
when OTHERS then
--dbms_output.put_line( sqlerrm );
rollback;
return(-1);
end GET_SEQ;
...全文
489 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
smallMage 2013-08-14
  • 打赏
  • 举报
回复
create or replace procedure batch_his( v_sett_date varchar2 ) is CNT_ERROR exception; v_cnt integer; begin select count(*) into v_cnt from his_trans where settle_date=v_sett_date; if v_cnt < 1 then raise CNT_ERROR; end if; insert into batch_save select sysdate, t.* from his_trans t where t.settle_date=v_sett_date; delete from his_trans where settle_date=v_sett_date; commit; exception when CNT_ERROR then raise_application_error( -1, 'his_trans表里无该日的数据' ); when OTHERS then rollback; RAISE;end batch_hist; 迁移到DB2下,异常怎么改写
smallMage 2013-08-14
  • 打赏
  • 举报
回复
v_last_month varchar(6) v_cd varchar(8) set v_last_month = to_char( to_date( substr( v_cd, 1, 6 ), 'yyyymm' ) - 1, 'yyyymm' ); 在db2怎么改写
smallMage 2013-08-05
  • 打赏
  • 举报
回复
create or replace function GET_SEQ( seq_name in char, o_seq_v out numeric ) return int AS t_sqlstr varchar(100); begin t_sqlstr := 'select '||seq_name||'.nextval from dual'; --dbms_output.put_line( t_sqlstr ); execute immediate t_sqlstr into o_seq_v; --select rrn.nextval into o_seq_v from dual; return(0); exception when OTHERS then --dbms_output.put_line( sqlerrm ); rollback; return(-1); end GET_SEQ; 迁移到DB2数据库,异常这一块不知道怎么处理
smallMage 2013-08-05
  • 打赏
  • 举报
回复
能否把上面两个迁移到DB2下,我学习一下
Mr_Bean 2013-08-02
  • 打赏
  • 举报
回复
http://pic.dhe.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.welcome.doc/doc/welcome.html 里面包罗万象了
smallMage 2013-08-02
  • 打赏
  • 举报
回复
发一些 DB2语法资料,以及DB2存储过程异常的处理
Mr_Bean 2013-08-01
  • 打赏
  • 举报
回复
可能您需要把功能跟你遇到的问题顺便说一下
smallMage 2013-08-01
  • 打赏
  • 举报
回复
create or replace procedure batch_his( v_sett_date varchar2 ) is CNT_ERROR exception; v_cnt integer; begin select count(*) into v_cnt from his_trans where settle_date=v_sett_date; if v_cnt < 1 then raise CNT_ERROR; end if; insert into batch_save select sysdate, t.* from his_trans t where t.settle_date=v_sett_date; delete from his_trans where settle_date=v_sett_date; commit; exception when CNT_ERROR then raise_application_error( -1, 'his_trans表里无该日的数据' ); when OTHERS then rollback; RAISE; end batch_hist; 迁移到DB2下,怎么改写

5,891

社区成员

发帖
与我相关
我的任务
社区描述
IBM DB2 是美国IBM公司开发的一套关系型数据库管理系统,它主要的运行环境为UNIX(包括IBM自家的AIX)、Linux、IBM i(旧称OS/400)、z/OS,以及Windows服务器版本
社区管理员
  • DB2
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧