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: Need assist w/ BEFORE INSERT trigger

Re: Need assist w/ BEFORE INSERT trigger

From: Martin Burbridge <pobox002_at_bebub.com>
Date: 14 May 2004 22:17:07 -0700
Message-ID: <45a06b65.0405142117.2cd5a8df@posting.google.com>


Ed Stevens <nospam_at_noway.nohow> wrote in message news:<oq0aa0hgbrsdhido89vo6p0i85igk31mu7_at_4ax.com>...
>
> Here's what I have:
>
> CREATE OR REPLACE TRIGGER TRG_MSGRTR_FORCE_PK
> BEFORE INSERT
> ON MESSAGE_ROUTER
> REFERENCING OLD AS OLD NEW AS NEW
> FOR EACH ROW
> begin
> :NEW.MSGRTE_MSG_SEQNBR := SQ_MSG_SLNO.NEXTVAL;
> END;
> /
>
> which yeilds this error
>
> PLS-00357: Table, view or sequence reference 'SQ_MSG_SLNO.NEXTVAL' not
> allowed in this context.
>

Good idea, you just need to wrap the sequence in a select e.g.

select sq_msg_slno.nextval
into :new.msgrte_msg_seqnbr
from dual;

On a side note why is the redundant line referencing old as old ... etc so common, is it from the docs? Received on Sat May 15 2004 - 00:17:07 CDT

Original text of this message

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