sql - how to stop the Plsql procedure block -
i wants stop plsql procedure if exception happens on calling sub procedure.
for below example ,
i wants stop entire process if first_sub_proc gives exception. had used "return" statement here. there no use. always,if thing happens on first_sub_proc, execute exception block of first_sub_procdure. hence after, go main function , start processing second_sub_proc.
any suggestion ?
create or replace package body testing_pk procedure first_sub_proc begin dbms_output.put_line('entering first sub'); execute immediate 'truncate table not_present'; exception when others dbms_output.put_line('first sub procedure exception '); -- *****need stop entire process here **** end; procedure second_proc begin dbms_output.put_line('entering second sub'); execute immediate 'truncate table not_present'; exception when others dbms_output.put_line('second sub procedure exception '); end; procedure main_proc begin dbms_output.put_line('entering main '); first_sub_proc(); second_proc(); exception when others dbms_output.put_line('main procedure exception '); end;
instead of return
try raise
or raise_application_error(-20800, 'the dreaded thing has happened');
.
of course, understand under the program should stop bit undefined.
Comments
Post a Comment