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

Home -> Community -> Usenet -> c.d.o.misc -> increment-trigger

increment-trigger

From: Marius Westermann <mariusmun1999_at_yahoo.de>
Date: Sat, 17 Aug 2002 15:21:20 +0200
Message-ID: <ajlika$vl4$06$1@news.t-online.com>


Hi there,

I try to do an auto_increment-funtion with a trigger:

I have a sequence:
Create or replace sequence KI_SEQ increment by1 start with 1 cache 2;

A table:
Create table KIDS(
KI_ID NUMBER(5) PRIMARY KEY NOT NULL,
NAME VARCHAR(200)
....etc);

And the Trigger
Create or replace Trigger KI_PK before insert on KIDS for each row Begin
Select KI_SEQ.NEXTVAL into :NEW.KI_ID from DUAL; End;
/

done.

When I start the query:
Insert into KIDS VALUES ('', 'Anything'.....) follows this Warning:
OCIStmtExecute: ORA-04098: trigger 'MY_OR.KI_PK' is invalid and failed re-validation
and the insert doesnīt happen.

I donīt know Oracle very much, but does anybody knows trigger like this? And knows where my error is?

Thx
Marius Received on Sat Aug 17 2002 - 08:21:20 CDT

Original text of this message

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