Home » Developer & Programmer » Precompilers, OCI & OCCI » Pro*C Arrays to stored procedure - urgent help
Pro*C Arrays to stored procedure - urgent help [message #94134] Fri, 26 March 2004 10:50
ap
Messages: 9
Registered: June 2003
Junior Member
How to pass arrays in Pro*C to a stored procedure in oracle?

My stored proc looks like this:

  TYPE my_array  is VARRAY(50) OF VARCHAR2(100);
  PROCEDURE my_test_proc( v_p1   IN varchar2,
     v_p2  IN number,
     v_p3  IN number,
     v_p4  OUT my_array);     

Say I am taking in a date as varchar2 (p1) and upto 30 days (p2), I want every alternate or every 3 or every 4.. (p3) dates to be stored in my array (p4).

This stored proc gets the output well with my pl/sql block, where I declare the last parameter as:
       p4_arr test_pkg.my_array;
and call the package:      
      my_test_pkg.my_test_proc(p1,p2,p3,p4_arr); 

How can I declare the same in my Pro*C code?

All these did not work:

VARCHAR v_array[[50]][[100]];

char v_arr[[50]][[100]];

EXEC SQL TYPE vc2_arr IS STRING(50) REFERENCE;
vc2_arr   v_out_arr;
     
EXEC SQL TYPE vc2_arr IS my_test_pkg.my_array REFERENCE;
vc2_arr   v_out_arr;

typedef char vc2_arr[[55]];
EXEC SQL TYPE vc2_arr IS VARCHAR2(100) REFERENCE;

For all these I got the same error:
PLS-00306: wrong number or types of arguments in call to 'MY_TEST_PROC'

When I used VARRAY or

v_arr my_test_pkg@v_dbName.my_array;

 
I got a compilation error.
Previous Topic: Blob insert with OCI
Next Topic: wrong machine class
Goto Forum:
  


Current Time: Thu Mar 28 16:10:34 CDT 2024