【问题标题】:PHP: oci_execute(): ORA-01008: not all variables boundPHP: oci_execute(): ORA-01008: 并非所有变量都绑定
【发布时间】: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(这是一张图片):

【问题讨论】:

    标签: php oracle plsql


    【解决方案1】:

    你的函数有三个参数并返回一个值。您的函数返回的值既不是游标,也不是浮点数!

    您正在尝试仅绑定到参数并将浮点数与光标组合

    :result 不是光标。你的光标是:pCURSEUR。 所以它应该看起来像:

    $curs = oci_new_cursor($conn);
    oci_bind_by_name($stid, ":pCURSEUR", $curs, -1, OCI_B_CURSOR);
    oci_bind_by_name($stmt, ":result", $result);
    

    我没有测试它,但它应该会告诉你方法

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-11
      • 1970-01-01
      • 2011-09-22
      • 2021-12-18
      • 2012-09-05
      • 1970-01-01
      • 2014-01-29
      • 2020-05-06
      相关资源
      最近更新 更多