I'm using PHP 5.5 on Windows with the PDO extension. Everything with oracle worked so far even with plsql scripts. The following is simplified code from my plsql package and my php code.
Basically I just want to hand the array $remarks over to the plsql procedure VARRAY_TEST. It's not about the logic of the function, it's about the pdo call itself.
TYPE remarkarray IS VARRAY(64) of varchar2;
PROCEDURE VARRAY_TEST
(
remarks IN remarkarray,
examplemsg OUT varchar2
)
AS
BEGIN
for remarkcounter in remarks.first ..remarks.last loop
examplemsg := examplemsg || ' ' || remarks(remarkcounter);
end loop;
END VARRAY_TEST;
Now comes my PHP-PDO code.
$exampleMsg = "";
$remarks = ["hoho", "haha"];
$query = $this->prepare("begin MY_PACKAGE.VARRAY_TEST(:remarks, :exampleMsg); end;");
try
{
$query->bindParam(':remarks', $remarks, PDO::PARAM_STR);
$query->bindParam(':exampleMsg', $exampleMsg, PDO::PARAM_STR, 200);
$query->execute();
var_dump($exampleMsg);
}
catch(Exception $ex)
{
var_dump($ex);
}
Unfortunatelly the following exception is thrown:
class PDOException#50 (9) {
...
string(257) "SQLSTATE[HY000]: General error: 6550 OCIStmtExecute: ORA-06550: row 1, column 7:
PLS-00306: Wrong number or types of arguments in call 'VARRAY_TEST'
ORA-06550: Zeile 1, Spalte 7: PL/SQL: Statement ignored (ext\pdo_oci\oci_statement.c:148)"
...
}
Does anyone have any idea how fix that? Also workarounds are highly appreciated.
Thx in advance.
EDIT:
Tried so far without success:
Removed the last/third parameter altogether from
$query->bindParam(':remarks'...class PDOException#50 (9) { ... string(257) "SQLSTATE[HY000]: General error: 6550 OCIStmtExecute: ORA-06550: row 1, column 7: PLS-00306: Wrong number or types of arguments in call 'VARRAY_TEST' ORA-06550: Zeile 1, Spalte 7: PL/SQL: Statement ignored (ext\pdo_oci\oci_statement.c:148)" ... }Added
PDO::PARAM_STMTin stead ofPDO::PARAM_STRresulting inclass PDOException#50 (9) { ... string(144) "SQLSTATE[HY000]: General error: 1008 OCIStmtExecute: ORA-01008: Not all variables seem to have a bound value (ext\pdo_oci\oci_statement.c:148)" ... }