Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger syntax
David Vodnansky <vodnansky_at_icl.cz> scritto nell'articolo
<32F074C3.15F3_at_icl.cz>...
> Hi all,
>
Hi and sorry for my english
> I have problems with trigger syntax in Oracle (I usually use Interbase).
> Simple example :
>
> create table adresy (id number(3,0),text varchar2(25));
> create sequence gen_adresaid ......;
>
> CREATE TRIGGER gen_adr_id
> BEFORE INSERT ON ADRESY
> FOR EACH ROW
> BEGIN
> new.id:=gen_adresaid.nextval; <--- this line is wrong, why ?
> end;
>
I don't know if my solution is a workaround but i write my trigger like
this:
create or replace trigger ....
...
IF :NEW.id IS NULL THEN
SELECT sq_my_sequence.NEXTVAL INTO :NEW.id FROM DUAL;
END IF;
I hope this is help for you
bye
-- Andrea A.Savino_at_stm.itReceived on Sat Feb 01 1997 - 00:00:00 CST