Setting exit status in PLSQL
572704Sep 13 2010 — edited Sep 13 2010Hi All,
Is there a way I can set exit status of PLSQL code to particular value depending on the satisfying condition.
For example consider following code:
set serveroutput on;
declare
app_id_cnt number;
app_name_cnt number;
sql_exit_sts number := 0;
begin
select count(app_id) into app_id_cnt from apps;
select count(app_name) into app_name_cnt from apps where app_name = 'BB';
dbms_output.put_line(app_id_cnt);
dbms_output.put_line(app_name_cnt);
if app_id_cnt = app_name_cnt
then
dbms_output.put_line('Success');
else
dbms_output.put_line('Failure');
sql_exit_sts := 213;
end if;
--return(sql_exit_st);
dbms_output.put_line(sql_exit_sts);
if sql_exit_sts = 213
then
exit 213;
else
exit 0;
end if;
end;
/
The above code doesn't work. My aim is to make plsql code exit with 213 if a particular condition is satisfied or else exit with default set value of 0.