Results 1 to 2 of 2

Thread: Show Message

  1. #1
    Join Date
    Jun 2003

    Unanswered: Show Message

    I want to create an insert trigger, which puts data into a main table instead of a view - but only when data is valid. When data is not valid, I want the user to get a message telling him, that the data is not valid and is not inserted into main table:

    For example:

    create trigger validate_input instead of insert on main_view for each row
    if length(column1) > length(column2) then
    "SHOW MESSAGE: Your data is not valid - data is not inserted"
    insert into main_table (column1, column2) values (:new.column1, :new.column2);
    end if;

    I was looking at something like
    raise_application_error ('Your data is not valid - data is not inserted');
    at the SHOW MESSAGE part, it worked, but got some other errors, like

    insert into main_view (column1,column2) values ('ABCDEF','ABC')
    Error at line 2
    ORA-20001: 'Your data is not valid - data is not inserted
    ORA-06512: at "VALIDATE_INPUT", line 4
    ORA-04088: error during execution of trigger 'VALIDATE_INPUT'

    Data is inserted from external programs

  2. #2
    Join Date
    Nov 2003
    Provided Answers: 23
    You cannot "show a message" from a trigger (remember the trigger code is running on the remote server).

    Your program (the one that inserts the data) needs to catch the error and display the error message to the end user

Tags for this Thread

Posting Permissions

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