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: <seci_at_ludens.elte.hu>
Date: 1997/12/03
Message-ID: <1997Dec3.073423.45808@ludens>#1/1

hello,
In article <01bcfcdc$3a121700$LocalHost_at_michal>, "Michal Motalík" <cross_at_zl.inext.cz> writes:
> I am developing a client/server project which will run on both 
> Interbase and Oracle. I wrote a trigger which sets unique numbers 
> from generator to primary index column on Interbase. I want to 
> write similar trigger on Oracle but i have a problem.
>
> I can not create trigger:
>
> CREATE TRIGGER tabtrig
> BEFORE INSERT ON tab
> FOR EACH ROW
> BEGIN
>   :NEW.id := tabseq.NEXTVAL;

sequences are ony allowed in SQL statements

	SELECT tabseq.nextval INTO id FROM DUAL;
	:new.id := id;
 

> 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?
>                   
> Michal Motalík
> cross_at_zl.inext.cz

HTH
        peter Received on Wed Dec 03 1997 - 00:00:00 CST

Original text of this message

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