Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger syntax

Re: Trigger syntax

From: Andrea <A.Savino_at_agora.stm.it>
Date: 1997/02/01
Message-ID: <01bc0f8c$29bb2560$LocalHost@armada-savand>#1/1

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.it
Received on Sat Feb 01 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US