儲存過程例子
阿新 • • 發佈:2019-01-26
CREATE OR REPLACE PROCEDURE PRO_THK08 (AAE002 number ,AAA027 varchar2) IS err_code VARCHAR2 (100):= NULL; err_mesg VARCHAR2 (1000) := NULL; BEGIN --開始,插入日誌表 insert into thk_log values ('thk08',sysdate,'','','開始生成THK08表資料'); commit; insert into thk08 (AAE002,aaa027,aab301,akb020,akb021,aka101,aka028,bke400,bke102,bke101) select aae002,aaa027,'441800','SR00001','test','','','',0,0 from dual; commit; --結束,插入日誌表 insert into thk_log values ('thk08',sysdate,'','','生成THK08表資料結束'); commit; EXCEPTION WHEN OTHERS THEN err_code :=SQLCODE; err_mesg :=substrb(SQLERRM, 1, 1000); --結束,插入日誌表 insert into thk_log values ('thk08',sysdate,err_code,err_mesg,'生成THK08表資料報錯'); commit; END PRO_THK08;