OCI8 函数
在线手册:中文 英文
PHP手册

oci_free_statement

(PHP 5, PECL OCI8 >= 1.1.0)

oci_free_statement释放关联于语句或游标的所有资源

说明

bool oci_free_statement ( resource $statement )

oci_free_statement() 释放关联于 Oracle 游标或语句的资源,该资源是作为 oci_parse() 的结果或者是从 Oracle 取得。

成功时返回 TRUE, 或者在失败时返回 FALSE.

参数

statement

A valid OCI statement identifier.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE.


OCI8 函数
在线手册:中文 英文
PHP手册
PHP手册 - N: 释放关联于语句或游标的所有资源

用户评论:

Jen M. (02-Oct-2008 07:05)

oci_free_statement doesn't always free up cursors.  I had a query where I performed the following functions in a loop:

OCIParse
OCIExecute
Oci_fetch_assoc
(Grab some field values)
OciFreeStatement

I didn't specify the use of a cursor, but ran into a "maximum
open cursors exceeded" error.  Within my code, I had one "select * from table_with_lobs" query.  When I changed the query to be "select a, b, c, from table_with_lobs" (where I specified the actual column names and where those columns were not LOB fields) the error message went away and I didn't have to resort to upping the max_open_cursors value in Oracle.

rada at instinctive dot it (04-Mar-2008 04:46)

If you are using cursors, make sure to free the statement *and* the cursor, especially if there is a possibility of running the proc/cursor again (e.g. with different parameters).

<?php

    oci_execute
($stmt);
   
oci_execute($crsr);

   
// iterate through cursor...
   
   
oci_free_statement($stmt);
   
oci_free_statement($crsr);
?>

You need to do it explicitly, closing connection for example does not seem to release the cursor.