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: sequence trigger

Re: sequence trigger

From: skv <skv_at_kpbank.ru>
Date: 1997/07/17
Message-ID: <01bc924e$fc495520$0bc47cc1@skv.hq.kem>#1/1

hi mark

        pseudo-columns currval & nextval are available only in SELECT list.See text below

Regards


         Konstantin V. Sartakov
                Kuzbassprombank
                       Kemerovo
                         Russia
           mailto:skv_at_kpbank.ru

Mark Aurit <mark_aurit_at_NOSPAM.mail.northgrum.com> ÚÁÐÉÓÁÎÏ × ÓÔÁÔØÀ <01bc9210$0864ff60$3d846380_at_MAURIT>...
> I want to use a sequence in my table, and Id like it done in a database
> trigger.
> I performed the following steps:
> 1) create sequence myseq;
> 2) create table mytable
> (pk number(13),
> name varchar2(30));
> 3) create or replace trigger mytrig
> before insert on mytable
> for each row
> begin
> update mytable
> set new.pk=myseq.nextval;

	select myseq.nextval 
                  into :new.pk
                  from dual;

> commit;

 Oops!Don't use COMMIT or ROLLBACK in triggers
> end;
>
> when I attempted an insert, insert into mytable (name) values ('mark');
> I got the following:
>
> SQL> insert into mytable (name) values ('mark');
> insert into mytable (name) values ('mark')
> *
> ERROR at line 1:
> ORA-00904: invalid column name
> ORA-06512: at line 2
> ORA-04088: error during execution of trigger 'MARK.MYTRIG'
>
> Appreciate any help!
> Thanks, Mark
> auritma_at_mail.northgrum.com
>
>
  Received on Thu Jul 17 1997 - 00:00:00 CDT

Original text of this message

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