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: Generating unique key numbers

Re: Generating unique key numbers

From: MarkP28665 <markp28665_at_aol.com>
Date: 1997/11/29
Message-ID: <19971129183700.NAA21919@ladder02.news.aol.com>#1/1

From: "Michal Motalík" <cross_at_zl.inext.cz>
>> CREATE TRIGGER tabtrig

BEFORE INSERT ON tab
FOR EACH ROW
BEGIN
  :NEW.id := tabseq.NEXTVAL;
END;
The sequence "tabseq" was created. I get the error PLS-00357. (reference to sequence is not permitted in these context) Does anybody know where the problem is? <<<

  1. Why not just reference the sequence in the insert statement? insert into table_name (key_col, etc...) values ( tabseq.nextval, etc...*)
  2. Try using a select into statement instead of pl/sql assignment select tabseq.nextval into v_variable from sys.dual; You should then be able to assign this variable to a row column

Good Luck.
Mark Powell -- Oracle 7 Certified DBA
- The only advise that counts is the advise that you follow so follow your own advise - Received on Sat Nov 29 1997 - 00:00:00 CST

Original text of this message

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