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: PL/SQL syntax, IS TABLE OF and .extend

Re: PL/SQL syntax, IS TABLE OF and .extend

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Thu, 24 Oct 2002 14:13:59 +0400
Message-ID: <ap8ha7$qjb$1@babylon.agtel.net>


.EXTEND does not apply to INDEX-BY (aka PL/SQL) tables, only to nested tables (those without INDEX BY clause.) With PL/SQL tables, array elements are created automatically when you access them by index, no need for explicit extend.

-- 
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"Volker Apelt" <gq437x_at_yahoo.de> wrote in message news:lgu1jccid2.fsf_at_mu.biosolveit.local...

>
> Do you know how to use IS TABLE OF and .EXTEND in PL/SQL
> functions?
>
> I can define a TYPE with a PL/SQL table, but I have not yet
> found the proper syntax to .EXTEND it in a procedure.
>
> I tried all three forms from the PL/SQL reference
> manual but all are rejected with this syntax error.
>
> PLS-00306: wrong number or types of arguments in call to 'EXTEND'
>
> How should I fix my code?
>
> Thank you,
>
> Volker
>
> --------------------- EXAMPLE CODE
>
> create or replace package with_syntax_error as
> TYPE sequence_id_list IS TABLE OF NUMBER index BY binary_integer;
> FUNCTION my_func( i_count IN POSITIVEN) RETURN sequence_id_list;
> END with_syntax_error;
> /
> --
> --
> create or replace
> package BODY with_syntax_error as
>
> FUNCTION my_func( i_count IN POSITIVEN ) RETURN sequence_id_list
> as
> ret sequence_id_list ;
> begin
> /* case 1 */
> ret.extend(i_count);
> /* case 2 */
> ret.extend;
> /* case 3 */
> ret.extend(i_count,0);
> /* do something with ret -- not shown here */
> return ret;
> end;
>
> END with_syntax_error;
> /
> show errors
> ----------------------------- END EXAMPLE
> compiling them in sqlplus returns:
>
> Warning: Package Body created with compilation errors.
>
> SQL> Errors for PACKAGE BODY WITH_SYNTAX_ERROR:
>
> LINE/COL ERROR
> -------- -----------------------------------------------------------------
> 8/4 PLS-00306: wrong number or types of arguments in call to 'EXTEND'
> 8/4 PL/SQL: Statement ignored
> 10/4 PLS-00306: wrong number or types of arguments in call to 'EXTEND'
> 10/4 PL/SQL: Statement ignored
> 12/4 PLS-00306: wrong number or types of arguments in call to 'EXTEND'
> 12/4 PL/SQL: Statement ignored
> SQL>
>
> --
> Volker Apelt
>
>
Received on Thu Oct 24 2002 - 05:13:59 CDT

Original text of this message

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