Re: Sequences

From: (wrong string) ørn Aambø <kolbjorn.aambo_at_ub.uio.no>
Date: 1996/08/07
Message-ID: <kolbjorn.aambo-0708961323370001_at_ubmac86.uio.no>#1/1


In article <4u8g3q$lts_at_newsbf02.news.aol.com>, markp28665_at_aol.com (MarkP28665) wrote:

> Try adding a variable to your procedure and selecting the sequence into
> it.

It was actually the DUAL systems table that I missed.
>

: <Snipped!>
:
> CREATE OR REPLACE FUNCTION SA RETURN NUMBER IS
> id NUMBER;
> BEGIN
> select sq.nextval
> into id
> from sys.dual;
> RETURN id;
> END SA;
>
> You might need to check my typing, but this is the way you want to get
> around the problem. If your sequence is fairly small (low maxvalue) and
> was created with the nocycle option you may want to add an exception block
> for 'no data found', but you probably do not need it.
>

Thank you for the advice, it worked! but would it not be a good idea for ORACLEs manual writers to make the usage of Sequences a little more clear. Not knowing about the DUAL table I had a hard time understanding what I read about Sequences on pages 4-214 through 4-219 in ORACLE 7 Server SQL Reference and not having it work properly. There are no menition of the DUAL table except on page 4-422 in ORACLE 7 Server SQL Reference and I did not know why I should be looking there before you gave me your advice. I think this is a good
example of how ORACLEs obscure documentation make it's use a nightmare! Received on Wed Aug 07 1996 - 00:00:00 CEST

Original text of this message