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 -> Trigger + sequence

Trigger + sequence

From: Detlef Kandziora <KanCom_at_bigfoot.com>
Date: Mon, 07 Jun 1999 19:44:58 GMT
Message-ID: <375c1e2d.52980682@news.komtel.net>


I have a problem to realize a trigger to insert sequence-numbers into a primary key.

the table and the sequence itself works fine, if I do it by sql-insert-statement like this:

insert into departement (dept_id, dept) values (dept_id_seq.nextval, 'XXX') but I need it automatically because of an external application via ODBC. Here is my Trigger-construction and the error-message:

create trigger dept_insert
BEFORE insert on departement
for each row
begin

   insert into departement values (dept_id_seq.nextval, :new.dept ); end;

Statement processed.

SQLWKS> insert into departement (dept_id, dept) values(null, 'XXXX');

ORA-01722: invalid number
ORA-06512: at "RZADMIN.DEPT_INSERT", line 2
ORA-04088: error during execution of trigger 'RZADMIN.DEPT_INSERT'

The null-value should be overritten by the trigger !?

        Can anybody help about that ? thanks Detlef Received on Mon Jun 07 1999 - 14:44:58 CDT

Original text of this message

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