Hi,

I want to call a procedure dynamically which returns a pl/sql table (OUT
Parameter).

This is the package where the procedure is defined.

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

procedure proc1(no number, pltab out dbms_sql.varchar2_table)
as
tempdate date;
begin
select sysdate into tempdate from dual;
pltab(1):='First';
pltab(2):='Second';
pltab(3):='Third';
pltab(4):='Fourth';
pltab(5):='Fifth';
end proc1;
end pk1;
/
===================================

Anonymous pl/sql block calling 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,2);
dummy := dbms_sql.execute(c);
dbms_sql.close_cursor(c);
end;
/

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 895
ORA-06512: at "SYS.DBMS_SQL", line 140
ORA-06512: at line 21

I am getting the above error.
Can anyone tell me what is wrong in this code?

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