Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: pl/sql question?
You are correct the control ofthe program goesto the exception.
but you can have many exceptions in you code, you also can have exception
inside another exception.
eg
declare
begin
begin
select name from emp;
exception when no_data_found then
dbms_output.put_line('No data found');
end;
exception when others then
dbms_output.put_line('Others');
begin
select name from org; exception when no_data_found then dbms_output.put_line('No data found');end;
end;
Tom
yliu_at_creighton.edu wrote in message ...
>Hi there,
>
>I am new to pl/sql. I have a generic pl/sql question. Usually, a pl/sql
>block (or subprogram) has the following structure:
> DECLARE
> ...
> BEGIN
> ...
>
> EXCEPTION
> ...
> END;
>My understanding is when a exception happens, the control is passed to the
>exception part of the pl/sql program, and is not returned to the original
>block. So my question is: 'What happened to all the processing before the
>exception occurs? Does this mean all the processing are rolled back?'
>I was told that always put a commit before the END of the pl/sql program,
>but if a exception occurs, all the processing is uncommited even if I have
>a commit right before the END of the pl/sql program, is this right? What
>are the ways that I can use in pl/sql programs that will keep on
>processing the rest of data even though there is an exception?
>
>Thank you very much for your time and help.
>
>Yongge
>yliu_at_creighton.edu
>
Received on Wed Sep 22 1999 - 18:03:42 CDT
![]() |
![]() |