Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    1

    Unanswered: exception handler dilemma

    hi,

    we are creating a program on which when an error occurs it should produce an alert message that will display what kind of error and its error messge.. however, were having difficulty on how to declare the exception inside the code that we have already created. since we are using the if-statement.

    we are really new about this exception handler.. so here's our code.

    DECLARE
    ALERT NUMBER;
    begin
    if :chkselect = 1 then
    forms_ddl('grant select on ' || :table_name || 'to '|| :role);
    end if;

    if :chkinsert = 1 then
    forms_ddl('grant insert on ' || :table_name || ' to ' || :role);
    end if;

    if :chkupdate = 1 then
    forms_ddl('grant update on ' || :table_name || ' to ' || :role);
    end if;

    if :chkdelete = 1 then
    forms_ddl('grant delete on ' || :table_name || ' to ' || :role);
    end if;

    end;

    ----
    this is what weve come up with, and its not functioning correctly so if you have any idea on how to insert it on the code above and what's wrong with this code.. thanks..

    IF SQLCODE = -1917 THEN
    ALERT := SHOW_ALERT('ERROR');
    END IF;
    IF SQLCODE = -942 THEN
    ALERT := SHOW_ALERT('ERROR');
    END IF

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Create the 'AERROR' alert and try to use this code as an example. I hope it'll help.
    Code:
    DECLARE
       al_id       alert;
       al_button   NUMBER;
    BEGIN
       if :chkselect = 1 then 
          forms_ddl('grant select on ' || :table_name || 'to '|| :role);
       end if;  
       /* the rest of your code */
    
    EXCEPTION
       WHEN OTHERS THEN
          IF SQLCODE = -1917 THEN
             al_id := FIND_ALERT ('AERROR');
             SET_ALERT_PROPERTY (al_id, alert_message_text, 'Error 1917');
             al_button := SHOW_ALERT (al_id);
          END IF;
       
          /* the rest of your IFs or WHENs*/
    END;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •