Help with Database Trigger
Date: 1995/06/04
Message-ID: <3qrhla$123_at_raffles.technet.sg>#1/1
I want to create a database trigger to validate the values of some fields
whenever there's any insert/update on table.
Example :
Table1 has 3 fields :
The trigger I tried to create is as follows :
create trigger
field1 varchar2(5)
field2 varchar2(5)
field3 varchar2(5)
after insert or update on table1
begin
if field1 is null
then
if field2 is not in ('A', 'B', 'C')
then raise_application_err( .........);
end if;
else
if field2 is null or field3 is not in ('X', 'Y')
then raise_application_error(.............);
end if;
end;
When I tried to create the above trigger, I received error message saying
"field1" is not declared!
"field1" is actually from the table TABLE1; why must I declare the field?
How can I write the above trigger to validate the values of the field before
user commits the record into the table?
Prompt reply is appreciated.
Received on Sun Jun 04 1995 - 00:00:00 CEST