Home » Developer & Programmer » Forms » how to overide oracle prdefined errors in form
how to overide oracle prdefined errors in form [message #134994] Mon, 29 August 2005 06:16 Go to next message
Ravi1234
Messages: 3
Registered: August 2005
Location: noida
Junior Member
my problem is like this
1.in form i have save button in that i written a WBP triiger
in this i am calling a data base procedure to save my text
item values.
2 problem is if user doesn't provide any value in the form
database procedure considers it has null value and it is giving
ora 1400 error so i have to handle this
where actually i wrote the code
so that my message will overrides the predefined message
the code is like this
PROCEDURE ERROR_TRAP
IS
  ERRNO     NUMBER := ERROR_CODE ;
  ERRTXT    VARCHAR2(80) := ERROR_TEXT ;
  ERRTYP    VARCHAR2(3) := ERROR_TYPE ;
-- DBMSERRCODE NUMBER;
--DBMSERRTEXT VARCHAR2(200);
  ALERT_ID  ALERT := FIND_ALERT('CHECK') ;
  NUM       NUMBER ;
BEGIN
  IF ERRNO IN (40106,
              40405,
              41008,
              40355,
              40102,
              40738,
              40401,
              10259,
              41009,
              41050,
              41003,
              40815,
              41051,
              41045,
              40831,
              40405,
              40735) THEN
    NULL;
  ELSIF ERRNO = 41049 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'You are not allowed to Delete Record!');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 40602 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'You can''t make the changes to record here!');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 40207
        OR ERRNO = 40209 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       ERRTXT);
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 40202 THEN
    NULL;
  ELSIF ERRNO = 40202 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'Enter only Numbers!');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 40100 THEN
    NULL;
  ELSIF ERRNO = 40505 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'No More Scan or Images are awailable!');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 41830 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'No Value Contains List of Values Entry!');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 50004
        OR ERRNO = 50026
        OR ERRNO = 50002 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'Date should be Entered in DDMMYYYY format !');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 40200 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'Field is not updatable, Please first press insert or update button from toolbar!');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 50016 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'Only Numbers Can be entered !');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 40508 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'Unique key voilated !');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 40501 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'Record is locked by other user for modification !');
    ALERTBUTTON_PROP(1);
    RAISE FORM_TRIGGER_FAILURE;
  ELSIF ERRNO = 50013 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'Minus sign should be at first position Only !');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 10020 THEN
    SET_ALERT_PROPERTY(ALERT_ID,
                       ALERT_MESSAGE_TEXT,
                       'Sorry, Maximum no. of User Working, Login after some time! !');
    ALERTBUTTON_PROP(1);
    NUM := SHOW_ALERT(ALERT_ID);
  ELSIF ERRNO = 40203 THEN
    NULL;
-- DBMSERRCODE :=DBMS_ERROR_CODE;
-- DBMSERRTEXT:= DBMS_ERROR_TEXT;
-- ELSIF DBMSERRCODE = -1400 THEN
-- SET_ALERT_PROPERTY(ALERT_ID,ALERT_MESSAGE_TEXT,'you didn t provided voucher date ! !');
-- ALERTBUTTON_PROP(1);
-- NUM:=SHOW_ALERT(ALERT_ID);


  ELSE
    MESSAGE(ERRTYP || '-' || TO_CHAR(ERRNO) || ':' || ERRTXT);
    RAISE FORM_TRIGGER_FAILURE;
  END IF;
END;
;

[Updated on: Mon, 29 August 2005 18:21] by Moderator

Report message to a moderator

Re: how to overide oracle prdefined errors in form [message #135086 is a reply to message #134994] Mon, 29 August 2005 18:22 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
The code looks good to me. What's the problem?

David
Re: how to overide oracle prdefined errors in form [message #135142 is a reply to message #134994] Tue, 30 August 2005 02:13 Go to previous messageGo to next message
Ravi1234
Messages: 3
Registered: August 2005
Location: noida
Junior Member
when i run with out voucher date it's not displaying this message'you didn t provided voucher date
Re: how to overide oracle prdefined errors in form [message #135144 is a reply to message #135142] Tue, 30 August 2005 02:18 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
That's because it is commented out.

David
Previous Topic: T List
Next Topic: strange image item behaviour..a bug??
Goto Forum:
  


Current Time: Fri Sep 20 03:45:36 CDT 2024