【问题标题】:Fetching an Oracle cursor into a PHP array?将 Oracle 游标提取到 PHP 数组中?
【发布时间】:2016-02-02 12:28:56
【问题描述】:

我正在尝试将 Oracle 游标提取到变量 $cursor1

$cur = oci_new_cursor($conn);
oci_bind_by_name($stmt, ":out_cursor", $cur,-1, SQLT_RSET);
oci_execute($cur);
$cursor1 = oci_fetch_assoc($cur);

不幸的是,这只返回光标的第一行。

如果我使用 while 语句循环,我可以获得所有结果:

while($row = oci_fetch_assoc($cur))
{
    print_r($row);
}

但是,我在整个系统中多次调用此过程,每次调用时光标都会返回不同的数据集 - 如果可能,我需要能够将它们全部放入一个通用数组中。

非常感谢

【问题讨论】:

    标签: php oracle stored-procedures oracle-call-interface


    【解决方案1】:

    很抱歉回答我自己的问题,但oci_fetch_all() 似乎可以解决问题:

    oci_fetch_all($cur, $cursor1, null, null, OCI_FETCHSTATEMENT_BY_ROW);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-12-23
      • 2022-09-27
      • 1970-01-01
      • 1970-01-01
      • 2011-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多