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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

what if a function doesn't return a value, and expected to hang.

610112Dec 21 2007 — edited Dec 24 2007
Hi, i'm using D2K, 6i forms.
i've a function something like this:
/* Function returns current slno for a transaction.
-----------------------------------------------------------------
create or replace function gen_auto_slno_fn
(doc_vr varchar2,
branch_vr varchar2)
return varchar IS
genslno VARCHAR2(15) ;
BEGIN
BEGIN
SELECT lpad((nvl(SLNO,0)+1),5,0)
INTO genslno
FROM GEN_SLNO
WHERE doc_name = doc_vr
AND BRANCH_CODE=branch_vr;

return(genslno);

EXCEPTION
WHEN no_data_found then
Dbms_output.put_line('No data found in General Serial number for '||doc_vr);
raise_application_error(-20100,sqlerrm);
END;

END;

-----------------------------------------------
My problem is:

suppose if such branch_code does not exist, then
it will go exception part.
I was expecting the 'No data ...error message ' in my forms.
but Instead of that a message such as 'Unhandled exception occurs.

I also tried returning a value like :

EXCEPTION
WHEN no_data_found then
Dbms_output.put_line('No data found in General Serial number for '||doc_vr);
return('ERROR');
--raise_application_error(-20100,sqlerrm);
END;

It was working then.

My question is: how do I display the whole error message on my form and raise form_trigger_failure ?
( also the one in the subject line!)

Message was edited by:
abhijithdev

Comments

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

Post Details

Locked on Jan 21 2008
Added on Dec 21 2007
9 comments
1,342 views