Hello I am trying to pass in varrays from PHP to Oracle. I am using OCI8 and have earlier worked with varrays as arguments in stored procedures, and on compilation the types of those varrays are created. So while making collection instance on the PHP end, we can directly mention the collection name.
Ex:
$my_coll = oci_new_collection($c, 'MY_ARRAY');
where MY_ARRAY would be the varray type I had declared in the Oracle instance.
create or replace type MY_ARRAY as varray(100) of varchar2(20);
So when I create them outside a package, the type is compiled and would be ready during execution.
If I do that from packages, I am getting back the error
PHP Warning: oci_new_collection() [function.oci-new-collection]: OCI-22303: type ""."my_pack.my_array_type" not found
My package header would look like this
create or replace
PACKAGE my_pack
AS
TYPE my_array_type is VARRAY(200) of varchar2(20);
my_arr my_array_type;
function my_func(
in_id number,
in_arr my_array_type
)
return number;
end my_pack;
Now when I make a call from PHP to create an instance of collection, this is the way I do
$my_collection = oci_new_collection($connect,'my_pack.my_array_type');
Now I get the warning type not found.
My question is, how would I have to call the varray type that is in the package??? I am doing it as package.type_name, but I am getting the warning that says type not found.
This works for me:
If you need out:
Try to pass schema and typename in uppercase
Upd.
I've found no limitations in OCI Reference, but PL\SQL Reference was more informative:
Also from PL\SQL Reference (Table 5-1) all sorts of collections have restrictions. For example VARRAY declared at package level: