Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to build this specific trigger ?
You could create a sequense and use that to generate the next id.
tom
Olivier Utkala wrote in message <7rlvaj$inb$1_at_wanadoo.fr>...
>
>I need a trigger who incremente automatically the id column of a table.
>Is this trigger is BEFORE INSERT or AFTER INSERT ?
>I try some test and I have the returned error : ORA-04098.
>
>The SQL code of one of my test :
>
>CREATE OR REPLACE TRIGGER "MSG".INS_TEST BEFORE INSERT OR UPDATE OF "ID" ON
>"MSG"."TEST" DECLARE
> new_id INTEGER;
>BEGIN
> new_id := select max(id,1) from msg.test;
> id := new_id + 1;
>END;
>
>Thanks for any help.
>
>---------------------------------
>Olivier
>
>
Received on Wed Sep 15 1999 - 01:14:11 CDT
![]() |
![]() |