Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use raise_application_error in trigger

Status
Not open for further replies.

Sjoker

Programmer
Aug 4, 2000
30
NL
How do I use a raise_application_error in a trigger,
I've got this but it gives an error:
CREATE OR REPLACE TRIGGER test_trigger
BEFORE UPDATE
ON test_table
FOR EACH ROW
DECLARE
BEGIN
IF :OLD.column_1 IS NOT NULL AND :NEW.column_1 IS NOT NULL
THEN
RAISE_APPLICATION_ERROR ( -20001, 'this is not allowed') ;
END IF;
END;

I get the error:
ORA-20001: this is not allowed
ORA-06512: at "DENNIE.test_trigger", line 6
ORA-04088: error during execution of trigger 'DENNIE.test_trigger'

when I do an update of the specified column.

What am I doing wrong?

 
Everything's all right. If you update not empty column_1 you get this error - this is the purpose of your tirgger to prohibit to do some things e.g. update existing value in column_1 :)
 
why is this trigger not working?
when i execute this trigger, it gives an error that says:
identifier call_fin must be declared.
I know there is a field called call_now on the table tcall:
Please take a look:

create or replace trigger archive_call
after insert or update on tcall
FOR EACH ROW
BEGIN
IF (call_now = 'N' AND call_period = 'X') then
BEGIN
RAISE_APPLICATION_ERROR(-20001,'YOU MUST ENTER THE TYPE OF CALL');
DBMS_OUTPUT.PUT_LINE('YOU MUST ENTER THE TYPE OF CALL');
END;
call_period := call_period + 1;
END IF;
END;
tankem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top