Propagation of oracle exception SQL code www.2cto.com procedure test1 (p_RETCODE in out varchar2, p_retInfo in out varchar2); procedure test2 (p_RETCODE in out varchar2, p_retInfo in out varchar2 ); procedure test3 (p_RETCODE in out varchar2, p_retInfo in out varchar2); SQL code procedure test1 (p_RETCODE in out varchar2, p_retInfo in out varchar2) is begin insert into tree_tb (id, NODE_NAME) values ('1', '1'); test2 (p_R ETCODE, p_retInfo); if p_RETCODE <> 1 then raise test_exception; end if; if 1 = 1 then p_RETCODE: = '-1'; p_retInfo: = 'test1 insertion exception. '; Raise test_exception; end if; p_RETCODE: = '1'; p_retInfo: = 'test1 inserted successfully. '; Exception WHEN test_exception then DBMS_OUTPUT.PUT_LINE ('error Code' | p_RETCODE |': '| p_retInfo); rollback; when others then p_RETCODE: = SQLCODE; p_retInfo: = SUBSTR (SQLERRM, 1, 1000); DBMS_OUTPUT.PUT_LINE ('error Code' | p_RETCODE | ':' | p_retInfo); rollback; end; -- procedure test2 (p_RETCODE in out varchar2, p_retInfo in out varchar2) is begin insert into tree_tb (id, NODE_NAME) Values ('2', '2'); insert into tree_tb (id, NODE_NAME) values ('3', '3'); if 1 = 1 then p_RETCODE: = '-2'; p_retInfo: = 'insertion 2 failed'; raise test_exception; end if; insert into tree_tb (id, NODE_NAME) values ('4', '4 '); p_RETCODE: = '1'; p_retInfo: = 'test2 is successfully inserted. '; Exception WHEN test_exception then dbms_output.put_line ('errorcode:' | p_RETCODE | 'errorinfo' | p_fo retin); rollback; when others then p_RETCODE: = SQLCODE; p_retInfo: = SUBSTR (SQLERRM, 1, 1000); DBMS_OUTPUT.PUT_LINE ('error Code' | p_RETCODE | ':' | p_retInfo); rollback; end;/*** @ Author: ma hongmin * @ function description: test the atomicity and consistency of transactions when a stored procedure calls multiple stored procedures at the same time * @ param retcode out returns the encoding * @ param retinfo out returns the information corresponding to the encoding */procedure test3 (p_RETCODE in out varchar2, p_retInfo in out varchar2) is begin test1 (p_RETCODE, p_retInfo); if p_RETCODE <> 1 then raise test_exception; end if; insert into tree_tb (id, NODE_NAME) values ('5 ', '5'); exception WHEN test_exception then response ('errorcode: '| p_RETCODE | 'errorinfo' | p_retInfo); rollback; when others then p_RETCODE: = SQLCODE; p_retInfo: = SUBSTR (SQLERRM, 1, 1000); DBMS_OUTPUT.PUT_LINE ('error Code' | p_RETCODE | ':' | p_retInfo); rollback; end;