Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Overiding triggers!
George wrote
>An insert trigger assigns a sequence
>value to a field. However on some insert events
>I would like to assign a value from another source
>to this field.
For this very example, I'd simply check if a value is supplied. If not, then get one in the trigger:
create or replace trigger my_trigger
before insert or update of my_table
begin
if :new.my_column is null then
if inserting then select my_sequence.next_val into :new.my_column from dual; else -- updating raise_application_error(-2000, 'Cannot set my_column to null'); end if;
Arjan. Received on Thu Feb 18 1999 - 10:19:01 CST