Hi,

I want to return a PL/SQL Table dynamically from a pl/sql procedure
dynamically.

Here , is the package which has the procedure :

====================
create or replace package body pk1 as

procedure proc1(no number, pltab out dbms_sql.varchar2_table)

as
tempdate date;
begin
pltab(1):='First';
pltab(2):='Second';
pltab(3):='Second';
pltab(4):='Second';
pltab(5):='Second';
end proc1;
end pk1;
====================

Fire. sql calls the above procedure :

Fire.sql
********
declare

pltab2 dbms_sql.varchar2_table;
ln_num number:=100;

c number;
dummy number;
stmt varchar2(100);

begin

  stmt := 'begin pk1.proc1(:ln_num, :pltab); end;';
  c := dbms_sql.open_cursor;

  dbms_sql.parse(c, stmt, dbms_sql.native);
  dbms_sql.bind_variable(c, ':ln_num', ln_num);
  dbms_sql.bind_array(c, ':pltab', pltab2,1,1);
  dummy := dbms_sql.execute(c);
  dbms_sql.close_cursor(c);
end;
/

On executing, the above code shows the foll. error:

declare
*
ERROR at line 1:
ORA-29252: collection does not contain elements at index locations in
call to dbms_sql.bind_array
ORA-06512: at "SYS.DBMS_SYS_SQL", line 605
ORA-06512: at "SYS.DBMS_SQL", line 146
ORA-06512: at line 21

Can anyone tell me the reason?
This code has been tried in 8.0.4 , 8.1.6 and 8.1.7 (SOLARIS) oracle
versions. It reports the same error.

Thank You.

Arul.

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Arul kumar
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to