Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bind PL/SQL array to PHP array

434281Nov 18 2009 — edited Nov 27 2009
Hi all!

I try to bind a PL/SQL array (nested tables, index by integer) returned by a PL/SQL-function to an PHP array.

Here is the code:

create or replace package MyPackage as

TYPE my_type IS TABLE OF VARCHAR2(1024);

FUNCTION MyFunction RETURN my_type;

end MyPackage;

create or replace PACKAGE BODY MyPackage is

FUNCTION MyFunction RETURN my_type IS
t_docs my_type;
begin
t_docs := my_type('val0','val1','val2');
return t_docs;

end MyFunction;
end MyPackage;

In the PHP-code ist looks like this

$query = "begin :vals := MyPackage.MyFunction; end;";
$stmt = oci_parse ($conn, $query);
oci_bind_array_by_name($stmt, ":vals", $vals_array, 5, 512, SQLT_CHR);
oci_execute ($stmt);

Output:
PLS-00382: expression is of wrong type. Error in Line....
This error point to
begin :vals := MyPackage.MyFunction; end;
^^^

Questions:
Is it generally possible to bind a pl/sql array to a php array? Or only the other was around?
Could you please post a snipet of code how to do it the right way :-)

Thanks a lot for your help! Christian
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 25 2009
Added on Nov 18 2009
3 comments
4,738 views