create trigger that checks if field on different table exist
Hi i am trying to create a trigger that when the user tries to insert data on table A column 1 check first on table B column 1 if id exist if not decline entry, this what i got so far but i get the error
ORA-04071: missing BEFORE, AFTER or INSTEAD OF keyword
create trigger check_artists
on RECORDINGS
for insert, update as
if not exists (select * from ARTISTS, RECORDINGS
where ARTISTS.artist_id = RECORDINGS.artist_id)
begin
print "Illegal Artist_ID!"
rollback transaction
end
go
i have also tried with the before keyword but then says something like invalid trigger sintax help please