Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Calling sequence from trigger
Try replacing it by
select sequence.nextval
into :new.columname
from dual;
AFAIK officially you shouldn't need that though.
Hth,
--
Sybrand Bakker, Oracle DBA
Alexandros Kotsiras, NYC <alexandros_k_at_prodigy.net> wrote in message
news:3887C565.D8A4B014_at_prodigy.net...
> Hello,
> My question is fairly simple and elementary but unfortunatelly i
> don't
> know much in PL/SQL.
> I wan't the PK of my table to be auto-incremented by one every time i
> insert a new record. (like the Autonumber datatype in Access)
> So i created a sequence with increment of 1 and then i tried to call
> the
> sequence from a trigger in a way :
>
> Begin
> :new.ColumnName := SequenceName.nextval ;
> End ;
>
> I tried BEFORE INSERT and also , AFTER INSERT FOR EAH ROW.
>
> But it doesnt seem to work although when i do
> "ALTER TRIGGER trigger_name COMPILE " the trigger is valid.
>
> Also if we assume that the trigger finaly works in SQL*PLUS, will it
> fire when i insert a new record in an Access form which talks to
> Oracle8
> via ODBC ?
> Or i would have to write an Access event procedure that does the same
> job at the client side ?
>
> Thanks a lot...if you can help me with some sample code i would
> appreciate it.
>
> Alex.
>
Received on Fri Jan 21 2000 - 00:06:53 CST
![]() |
![]() |