CLOSE 釋放和一個遊標關聯的資源。 一個遊標關閉後,不允許對其再做任何操作。一個不再使用的遊標應該關閉掉。
作者:何偉平來源:CMPP.net|2011-08-24 10:24CLOSE - 關閉一個遊標
SYNOPSISCLOSE name
DESCRIPTION 描述CLOSE 釋放和一個遊標關聯的資源。 一個遊標關閉後,不允許對其再做任何操作。一個不再使用的遊標應該關閉掉。
在一個事務用 COMMIT 或者 ROLLBACK 終止之後, 每個不可保持的已打開遊標都隱含關閉。如果創建事務通過 ROLLBACK 退出, 那麼一個可以保持的遊標隱含關閉。如果創建事務成功提交,那麼可保持的遊標保持打開, 直到執行一個明確的 CLOSE,或者客戶端斷開。
PostgreSQL 沒有明確的 OPEN (打開)遊標的語句; 我們認為一個遊標在聲明時就打開了。使用 DECLARE 語句聲明一個遊標。
EXAMPLES 例子
關閉遊標 liahona:
CLOSE liahona;
NAMECLOSE - close a cursor
SYNOPSISCLOSE name
DESCRIPTIONCLOSE frees the resources associated with an open cursor. After the cursor is closed, no subsequent operations are allowed on it. A cursor should be closed when it is no longer needed.
Every non-holdable open cursor is implicitly closed when a transaction is terminated by COMMIT or ROLLBACK. A holdable cursor is implicitly closed if the transaction that created it aborts via ROLLBACK. If the creating transaction successfully commits, the holdable cursor remains open until an explicit CLOSE is executed, or the client disconnects.
PARAMETERSname The name of an open cursor to close. NOTESPostgreSQL does not have an explicit OPEN cursor statement; a cursor is considered open when it is declared. Use the DECLARE statement to declare a cursor.
EXAMPLESClose the cursor liahona:
CLOSE liahona;
【責任編輯:
韓亞珊TEL:(010)68476606】