Re: New to Oracle 7/triggers

From: Steve Newhouse <aj583_at_lafn.org>
Date: 1996/01/09
Message-ID: <4ct0k3$9o0_at_symiserver2.symantec.com>#1/1


L Orcutt <d3j134> wrote:

>I am using a before insert row trigger to update the primary key column
>of a table to be equal to a sequence.nextval as follows:
 

>CREATE OR REPLACE TRIGGER equipment_before_insert
>BEFORE INSERT ON equipment
>FOR EACH ROW
>BEGIN
> :new.equipment_id := equipment_seq.nextval;
>END;
 
>When I do this I get the error:
 

>PLS-00357: Table,View Or Sequence reference 'EQUIPMENT_SEQ' not allowed in this
>context.
 

>I would think that this would be a common thing to do. Can anybody tell me what
>I'm doing wrong or how this is normally accomplished?
 

>Thanks in advance for any help.
 

>Larry Orcutt

Try
select equipment_seq.nextval into :new.equipment_id from dual; Received on Tue Jan 09 1996 - 00:00:00 CET

Original text of this message