【问题标题】:oci_bind_by_name: PHP Fatal error: Only variables can be passed by referenceoci_bind_by_name:PHP 致命错误:只能通过引用传递变量
【发布时间】:2014-02-02 13:50:11
【问题描述】:

我正在尝试从 Oracle 包中调用一个函数,但出现此错误:

PHP致命错误:只能通过引用传递变量

这是我的代码:

    $connection = $this->getConnection();

    if (!$connection){
        return null;
    }

    $s = oci_parse($connection, "begin my_package.my_function(
            :param1
        ); end;");

    //getting the error in this following line:
    oci_bind_by_name($s, ":param1", "13")


    if($result = oci_execute($s)){
             ....
    }
    ...

我一直在查看具有完全相同错误的其他帖子,但似乎都与此问题无关。

我在 Windows 7 机器上使用 PHP 版本 5.5.6 而不是 IIS 7.5。

这是我包装中的函数定义:

FUNCTION my_function(param1 IN VARCHAR2) RETURN CLOB IS
BEGIN
-- etc...
-- etc...
END;

【问题讨论】:

    标签: php oracle11g iis-7.5 oracle-call-interface


    【解决方案1】:

    oci_bind_by_name 的第三个参数是通过引用传递的,所以你需要先将它存储在一个变量中:

    $param1 = "13";
    oci_bind_by_name($s, ":param1", $param1);
    

    【讨论】:

      猜你喜欢
      • 2012-10-25
      • 1970-01-01
      • 1970-01-01
      • 2013-06-21
      • 2017-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多