【发布时间】:2019-11-27 17:03:43
【问题描述】:
我想用 PHP 调用一个 oracle 函数,但我得到了错误:
oci_execute(): ORA-01008: 并非所有变量都绑定
参数:
:pDATDEB = 21102019 (String)
:pDATFIN = 27102019 (String)
:pCURSEUR = (is an OUT Parameter) (Cursor)
代码:
$sql = "BEGIN :result := sceref.PACK_W_PLANNING.PLANNING_MISSIONS(:pDATDEB, :pDATFIN, :pCURSEUR); END;";
$stmt = oci_parse($conn, $sql);
// bind the first and last name variables
oci_bind_by_name($stmt, ':pDATDEB', $startDate);
oci_bind_by_name($stmt, ':pDATFIN', $endDate);
// bind the ref cursor
$refcur = oci_new_cursor($conn);
oci_bind_by_name($stmt, ':result', $refcur, -1, OCI_B_CURSOR);
// execute the statement
oci_execute($stmt);
// treat the ref cursor as a statement resource
oci_execute($refcur, OCI_DEFAULT);
oci_fetch_all($refcur, $data, null, null, OCI_FETCHSTATEMENT_BY_ROW);
// return the results
return ($data);
它适用于 SQL(这是一张图片):
【问题讨论】: