exit from a pl/sql block
Hi all. I'm on oracle 9i.
I have a problem: I launch my sql file, which has a part made of some SQL commands and then inside it there is a part that is a PL/SQL block.
What I want is that if a certain if condition is verified it must exit from PL/SQL block and also it must exit from all the file!
Here is a part of code:
drop table test1;
create table test1
as select * from test2;
create table prova_test1
as select * from test_1
where 1=2;
DECLARE
conta number := 0;
valore number := 0;
contap number := 0;
valorep number := 0;
istruzione varchar2(2000) := null;
BEGIN
select count(1), sum(val) into contap,valorep
from prova_test1;
select count(1), sum(val) into conta,valore
from test_1;
if conta <> contap or valore <> valorep then
istruzione := 'exit';
execute immediate istruzione;
else
others sql statements.....
....
....
end if;
end;
/
So what I want is that if the condition is verified it must exit from pl/sql block and also from all the process.
How can I achieve that??
Thanks for collaboration,
Fabrizio