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: Volker Apelt <gq437x_at_yahoo.de>
Date: 24 Oct 2002 10:35:50 +0200
Message-ID: <lgznt4cjyx.fsf@mu.biosolveit.local>


jocave_at_yahoo.com (Justin Cave) writes:

> 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.
>

Thank you Justin,
but the error message is still the same.

I tried

   ret.extend(i_count);
and

   ret.extend; ret(0) = 0;
   ret.extend(i_count-1);

but I receive

 PLS-00306: wrong number or types of arguments in call to 'EXTEND'

in both cases.

For the original problem (drawing N numbers from a sequence) I'll use the large table approach sugested by Alan and Daniel, but I'd like to understand the PL/SQL syntax error any way.

Bye,

Volker    

-- 
Volker Apelt                   
Received on Thu Oct 24 2002 - 03:35:50 CDT

Original text of this message

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