Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Generating unique key numbers
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