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: Dan Rippel <jford_at_mail.erols.com>
Date: 1997/01/31
Message-ID: <32f33d6a.2952027@news.erols.com>#1/1

to get the nextval out of the sequence, you have to select it.

instead of
> new.id:=gen_adresaid.nextval; <--- this line is wrong, why ?

use
select gen_adresaid.nextval
into new.id
from dual

On Thu, 30 Jan 1997 11:15:31 +0100, David Vodnansky <vodnansky_at_icl.cz> wrote:

>Hi all,
>
>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;
>
>Thanks for advice.
>
>-------------------
>David Vodnansky
>ICL Czech republic
>vodnansky_at_icl.cz
>-------------------
Received on Fri Jan 31 1997 - 00:00:00 CST

Original text of this message

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