In my application oracle procedure is currently called through unix script, when there is error in exception block we are handling something like this :-
PROC_LOGS('<PROC_NAME>', <TABLE_NAME>, 'Exception','Exception occured - '||SQLERRM);
PROC_LOG does nothing but inserts entry into log table but we need now to catch that error in unix also (return some value except 0) from where is it called so remaining process can be terminated best on that, what is the best way to do this?
CREATE OR REPLACE....
...
DECLARE
....
BEGIN
..
...
EXCEPTION
WHEN OTHERS THEN
PROC_LOGS('<PROC_NAME>', <TABLE_NAME>, 'EXCEPTION','EXCEPTION OCCURED - '||SQLERRM);
END;
Unix script part from where I m calling procedure
sqlplus <<-!
$US/$P@$I
set serveroutput on
@$SQL/execute_proc.sql $1 $2
execue_proc contains something like this :-
define IN_1 = '&1';
define IN_2 = '&2';
spool $SQL/test_&&IN
declare
P_IN_TABLE_NAME varchar2(250) := '&&IN_TABLE_NAME';
P_IN_REGION varchar2(250) := '&&IN_REGION';
begin
PROC_UPDATE_CHARGE_FACT(P_IN_TABLE_NAME,P_IN_REGION);
end;
/
spool off