Re: [HELP]: PL/SQL Exceptions to Forms4.

From: Guenter Gersdorf <G.Gersdorf_at_tu-bs.de>
Date: 1995/11/30
Message-ID: <49jp1s$lbn_at_ra.ibr.cs.tu-bs.de>#1/1


In article <Pine.A32.3.91.951127155717.28046A-100000_at_pilot.stu.cowan.edu.au>, st952943_at_pilot.stu.cowan.edu.au says...
>
>Howdy.
>
>Hope you can help me.
>
>Have implemented the following trigger in SQL*+ PL/SQL:
>
>CREATE TRIGGER AFFILIATION_TRIGGER
> BEFORE INSERT OR UPDATE OF Start_Date, End_Date ON Affiliation
> FOR EACH ROW
> DECLARE
> My_Exception EXCEPTION;
> BEGIN
> IF :New.Start_Date > :New.End_Date THEN
> RAISE My_Exception;
> END IF;
> END;
>/
>
>What the trigger is simply meant to do is ensure that start_date is less than
>or equal to end_date. If not it should call the exception My_Exception.
>
>Now when I goto Forms4 and create a form on table affiliation, I do get a
>raised error if the condition is true (ie start_date > end_date).
>However Oracle comes up with its standard FRM-40508: ORACLE err - unable
>to INSERT record. I don't want this. I want to capture this error and
>display a user friendly error to the message.
>
>How do I capture the exception?
>
>Note that I have not declared the exception in the PL/SQL or the Forms4.
>It is as is above.
>

Create an ON-ERROR Trigger, check if the Forms Function ERROR_CODE returns 40508, and if so, check DBMS_ERROR_CODE and DBMS_ERROR_TEXT for the Oracle Error.

Bye, Guenter


Guenter Gersdorf                         Phone:      +49/(0)531/391-7634
Inst. f. Werkzeugmaschinen               Fax:                      -5842
und Fertigungstechnik, TU Braunschweig   E-Mail:     G.Gersdorf_at_tu-bs.de
Langer Kamp 19b, D-38106 Braunschweig http://www.iwf.ing.tu-bs.de/~gg Received on Thu Nov 30 1995 - 00:00:00 CET

Original text of this message