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: Sequence returns multiple numbers

Re: Sequence returns multiple numbers

From: Greg Robocker <grobocker_at_paladindata.com>
Date: Fri, 7 May 1999 08:01:47 -0700
Message-ID: <JjDY2.2007$sT1.62706@news.uswest.net>


Did you check to see how many rows are in your DUAL table.

Greg
claese_at_my-dejanews.com wrote in message <7guts1$9kk$1_at_nnrp1.deja.com>...
>Hi all,
>
>I have a sequence defined by:
>
>CREATE SEQUENCE PRO140_FIFO
> INCREMENT BY 1
> START WITH 1
> MINVALUE 1
> MAXVALUE 2147483647
> CYCLE
>
>When I try to fetch the next sequence number, I get not one, but TWO values
>back:
>
>Oracle7 Workgroup Server Release 7.3.2.3.1 - Production Release
>With the distributed option
>PL/SQL Release 2.3.2.3.0 - Production
>
>SQL> select PRO140_FIFO.NEXTVAL from dual;
>
> NEXTVAL
>---------
> 21
> 22
>
>SQL>
>
>Obviously, using this sequence in a trigger will fail:
>
>create trigger tib_pro140 before insert
>on PRO140 for each row
>begin
> select PRO140_FIFO.NEXTVAL into :new.PRO140FIFO from DUAL;
>end;
>
>
>SQL> insert into PRO140 (EVENT, KRAN_NR, KRAN_TGM) VALUES (999, 99,
'Junk');
>insert into PRO140 (EVENT, KRAN_NR, KRAN_TGM) VALUES (999, 99, 'Junk')
> *
>ERROR at line 1:
>ORA-01422: exact fetch returns more than requested number of rows
>ORA-06512: at "MLS.TIB_PRO140", line 8
>ORA-04088: error during execution of trigger 'MLS.TIB_PRO140'
>
>
>SQL>
>
>Has anybody seen this behavior before? I would be *most* grateful for any
>assistance.
>
>TIA,
>
>Claes Engelin
>Prevas AB
>Gothenburg, Seden
>claes(dot)engelin(at)prevas(dot)se
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Fri May 07 1999 - 10:01:47 CDT

Original text of this message

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