Pass an array to a procedure input [message #299466] |
Tue, 12 February 2008 02:35 |
mbourret
Messages: 2 Registered: February 2008 Location: France
|
Junior Member |
|
|
Hi,
I have an array initialized by a cursor in the Pro*C, and I want to pass this array to my procedure in PL/SQL, how to declare the array in the Pro*C.
I have this in my database: The procedure contrat is in the package pu01. The type is not declare in the package.
create or replace string_array as table of varchar2(10);
procedure contrat(p in string_array) is
begin
forall i in p.first .. p.last
.......
end;
In pro*c I have this:
Char gTableauContrat[1000][10] ;
Short supprimer() {
VARCHAR lcontrat[BUF_LEN] = {0, ""};
Short lcpt = 0
Exec sql declare c1 for
Select c_contrat from tdcontrat;
Exec sql open c1 ;
…
Exec sql fetch c1 into :lcontrat
If (lcpt < 1000) {
Sprintf(gTableauContrat[lcpt], "%.*s",lcontrat.len,lcontrat.arr);
lcpt++;
} else {
exec sql execute
begin
pu01.contrat(
: gTableauContrat);
end
end-exec;
}
In this case it's a array to 1 dimension.
And I have also an array with two dimension and both elements are differents like my type in oracle:
create or replace type cpt_record as object (cpt varchar2(20), chaine varchar2(10));
create or replace type cpt_array as table of cpt_record;
Thanks.
|
|
|
|
|
|
|