I am trying to call an Oracle 11G Procedure.
Right out of the Oracle PHP Cookbook. After reading though the forum, i discovered that the best way to test this is to create a blank container and add the test code.
I think what I am missing is how to convert std PHP OCI sytax to Scriptcase Syntax.
I think i need the equivalent of oci_parse and oci_bind_by_name.
The second does invoke the DB, after I created a synonym to my procedure. I get an Oracle DB Error that looks promising …
ociexecute(): ORA-01008: not all variables bound
Error while accessing the database:
ORA-01008: not all variables bound
{SC_DB_ERROR_INI}View SQL{SC_DB_ERROR_MID}BEGIN s_sayHello(:name, :message); END;{SC_DB_ERROR_CLS}Close{SC_DB_ERROR_END}
Any help would be greatly appreciated. The syntax should be simular to mysql procedure calls one would think.
Thanks, Tom
Here are my code attempts.
I have tried simply calling the procedure.
// Tried this…
//Call s_sayHello(:name, :message);
// Tried this. This is causing the Error above and looks most promising.
//$sql = ‘BEGIN s_sayHello(:name, :message); END;’;
// sc_exec_sql($sql);
<?php
$conn = oci_connect(‘SCOTT’,‘TIGER’) or die;
$stmt = oci_parse($conn,$sql);
// Bind the input parameter
oci_bind_by_name($stmt,’:name’,$name,32);
// Bind the output parameter
oci_bind_by_name($stmt,’:message’,$message,32);
// Assign a value to the input
$name = ‘Harry’;
oci_execute($stmt);
// $message is now populated with the output value
print "$message
";
?>