Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: more than one number from sequence

Re: more than one number from sequence

From: Justin Cave <jocave_at_yahoo.com>
Date: 23 Oct 2002 14:14:05 -0700
Message-ID: <233b7a65.0210231314.674bd6c5@posting.google.com>


Volker Apelt <gq437x_at_yahoo.de> wrote in message news:<lgsmyx2og3.fsf_at_mu.biosolveit.local>...
> create or replace
> package BODY test_on_sequences as
> FUNCTION draw_N_ids( i_count IN NUMBER ) RETURN sequence_id_list
> as
> ret sequence_id_list ;
> i binary_integer := 0;
> new_key number := 0;
> begin
> ret.extend(i_count,0); -- line 8
> FORALL i IN 0 .. (i_count - 1)
> SELECT seq_employee_id.NEXTVAL INTO ret(i) FROM dual;
> return ret;
> end;
> END test_on_sequences;
> /
> show errors
> SQL>
>
> Errors for PACKAGE BODY TEST_ON_SEQUENCES:
>
> LINE/COL ERROR
> -------- -----------------------------------------------------------------
> 8/9 PLS-00306: wrong number or types of arguments in call to 'EXTEND'
> 8/9 PL/SQL: Statement ignored
> 10/12 PL/SQL: SQL Statement ignored
> 10/48 PLS-00437: FORALL bulk index cannot be used in RETURNING clause
> 10/55 PL/SQL: ORA-00904: invalid column name
> SQL>
I believe that you want to use the syntax "ret.extend(i_count)", without the ",0". Your syntax instructs the ret collection to append i_count copies of the 0th element to the end of the collection, which doesn't make sense since there isn't a 0th element yet.

Justin Cave Received on Wed Oct 23 2002 - 16:14:05 CDT

Original text of this message

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