Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Is pl/sql having on error case?

fsze88hohoSep 1 2008 — edited Sep 1 2008
HI,
I want to know is pl/sql having on error case to handling sql error?
following function will give me an error if invoice_seq havn't select nextval once.
any on error case instead of exception of following function?

function nextinvoicenumFunc RETURN NUMBER AS
nextinvoiceid number;
BEGIN
nextinvoiceid :=0;
select invoice_seq.currval +1 into nextinvoiceid from dual;
EXCEPTION
WHEN no_data_found THEN
SELECT min_value into nextinvoiceid FROM user_sequences WHERE sequence_name = 'invoice_seq';
RETURN nextinvoiceid;
END nextinvoicenumFunc;

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 29 2008
Added on Sep 1 2008
2 comments
261 views