oci_new_cursorとは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > oci_new_cursorの意味・解説 

oci_new_cursor

(PHP 5)
oci_new_cursor — 新規カーソル (ステートメントハンドル) を割り当て返す

説明

resource oci_new_cursor ( resource connection )
oci_new_cursor() は指定された接続に新規カーソルを割り当てます。
例 1542. Oracle ストアドプロシージャにおける REF CURSOR の使用例
<?php
// ストアドプロシージャ info.output が :data の REF CURSOR を返すと仮定する

$conn = oci_connect("scott", "tiger");
$curs = oci_new_cursor($conn);
$stmt = oci_parse($conn, "begin info.output(:data); end;");

oci_bind_by_name($stmt, "data", $curs, -1, OCI_B_CURSOR);
oci_execute($stmt);
oci_execute($curs);

while ($data = oci_fetch_row($curs)) {
   var_dump($data);
}

oci_free_statement($stmt);
oci_free_statement($curs);
oci_close($conn);
?>


例 1543. Oracle の select 文における REF CURSOR の使用例
<?php
echo "<html><body>";
$conn = oci_connect("scott", "tiger");
$count_cursor = "CURSOR(select count(empno) num_emps from emp " .
               "where emp.deptno = dept.deptno) as EMPCNT from dept";
$stmt = oci_parse($conn, "select deptno,dname,$count_cursor");

oci_execute($stmt);
echo "<table border=\"1\">";
echo "<tr>";
echo "<th>DEPT NAME</th>";
echo "<th>DEPT #</th>";
echo "<th># EMPLOYEES</th>";
echo "</tr>";

while ($data = oci_fetch_assoc($stmt)) {
   echo "<tr>";
   $dname  = $data["DNAME"];
   $deptno = $data["DEPTNO"];
   echo "<td>$dname</td>";
   echo "<td>$deptno</td>";
   oci_execute($data["EMPCNT"]);
   while ($subdata = oci_fetch_assoc($data["EMPCNT"])) {
       $num_emps = $subdata["NUM_EMPS"];
       echo  "<td>$num_emps</td>";
   }
   echo "</tr>";
}
echo "</table>";
echo "</body></html>";
oci_free_statement($stmt);
oci_close($conn);
?>


エラーの場合、oci_new_cursor()FALSE を返します。
注意: PHP バージョン 5.0.0 以前では、代わりに ocinewcursor() を使用しなければなりません。 まだこの名前を使用することができ、下位互換性のため oci_new_cursor() への別名として残されていますが、 推奨されません。

ocinewcursor

(PHP 4)
ocinewcursor — oci_new_cursor() のエイリアス

説明

この関数は次の関数のエイリアスです。 oci_new_cursor().



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「oci_new_cursor」の関連用語

oci_new_cursorのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



oci_new_cursorのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2024 by the PHP Documentation Group.

©2024 GRAS Group, Inc.RSS