CLOSE(7) PostgreSQL 9.2.7 Documentation CLOSE(7)NAME
CLOSE - close a cursor
SYNOPSIS
CLOSE { name | ALL }
DESCRIPTION
CLOSE 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.
PARAMETERS
name
The name of an open cursor to close.
ALL
Close all open cursors.
NOTES
PostgreSQL does not have an explicit OPEN cursor statement; a cursor is considered open when it is declared. Use the DECLARE(7) statement
to declare a cursor.
You can see all available cursors by querying the pg_cursors system view.
If a cursor is closed after a savepoint which is later rolled back, the CLOSE is not rolled back; that is, the cursor remains closed.
EXAMPLES
Close the cursor liahona:
CLOSE liahona;
COMPATIBILITY
CLOSE is fully conforming with the SQL standard. CLOSE ALL is a PostgreSQL extension.
SEE ALSO DECLARE(7), FETCH(7), MOVE(7)PostgreSQL 9.2.7 2014-02-17 CLOSE(7)
Check Out this Related Man Page
MOVE(7) SQL Commands MOVE(7)NAME
MOVE - position a cursor on a specified row of a table
SYNOPSIS
MOVE [ direction ] [ count ]
{ IN | FROM } cursor
DESCRIPTION
MOVE allows a user to move cursor position a specified number of rows. MOVE works like the FETCH command, but only positions the cursor
and does not return rows.
Refer to FETCH [fetch(7)] for details on syntax and usage.
NOTES
MOVE is a PostgreSQL language extension.
Refer to FETCH [fetch(7)] for a description of valid arguments. Refer to DECLARE [declare(7)] to define a cursor. Refer to BEGIN
[begin(7)], COMMIT [commit(7)], and ROLLBACK [rollback(7)] for further information about transactions.
USAGE
Set up and use a cursor:
BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;
-- Skip first 5 rows:
MOVE FORWARD 5 IN liahona;
MOVE
-- Fetch 6th row in the cursor liahona:
FETCH 1 IN liahona;
FETCH
code | title | did | date_prod | kind | len
-------+--------+-----+-----------+--------+-------
P_303 | 48 Hrs | 103 | 1982-10-22| Action | 01:37
(1 row)
-- close the cursor liahona and commit work:
CLOSE liahona;
COMMIT WORK;
COMPATIBILITY
SQL92
There is no SQL92 MOVE statement. Instead, SQL92 allows one to FETCH rows from an absolute cursor position, implicitly moving the cursor
to the correct position.
SQL - Language Statements 2002-11-22 MOVE(7)
I am programming some data loader of oracle with unix c, when I find new data file, then read it to database and delete it. but one issue, if the file is in process of creating, not been closed yet. I will read zero or part of data content, this will cause problem. I want to know whether some unix... (2 Replies)
Is it possible, in a Korn Shell script, to stop a cursor when I use the read command? More exactly, I try to have the cursor in a same line reading a value but not in a new line.
Maybe to display the value only if this value is right...
Do you have any idea about this? Is it possible?
Thanks... (2 Replies)
Hi all,
I am new to SQLPLUS, can anyone tell me what is the following codes doing?
DECLARE
cursor c1 is select bts_int_id,
max(ave_busy_tch/res_av_denom14) maxBusyTch
from p_nbsc_res_avail
where to_char(period_start_time,'yyyymmdd')=to_char((sysdate-1),'yyyymmdd')
group by... (4 Replies)
Hi
I have few files. For some files the cursor is at the end of last line. For other files, cursor is at the new line at the end.
I want to bring the cursor down to next line for the files that are having cursor at the end of last line
In otherwords, I want to introduce a blank line at the... (5 Replies)
Hi, i have just installed Sun Solaris 8 on the sun sparc server but when i run the browers and write a site to open it my browers automatically closed and when i run the browers window again it again automatically closed again.
can any body help me to resolve this issue (1 Reply)
How many ways are there to open a file in unix?
wha i know is mentioned below
suppose if xx is a filename, then
1) cat xx
2) more xx
3) view xx
4) less xx
I heard there are seven ways to open a file. If so, can anyone tell me all the ways to open a file and correct me the above... (3 Replies)
Discussion started by: venkatesht
3 Replies
7. Post Here to Contact Site Administrators and Moderators
I had a thread open and now it says it's closed. I had a question still on the forum and about 15mins after I posted my most recent question on it the thread said "closed". Why did this happen? I didn't violate any forum rules. Is there a limit on how many postings you can have in a single thread?... (1 Reply)
Discussion started by: hpicracing
1 Replies
8. Post Here to Contact Site Administrators and Moderators
I'm not so sure that this thread should have been closed. Though it was clearly homework the student was asking a specific question related to the assignment, but not the answer to the whole assignment.
/www.unix.com/unix-dummies-questions-answers/107494-how-get-rid.html .
IMHO The solution is... (1 Reply)
Hi Guys,
I'd like to know your opinion. A friend of mine claims, an open source OS like linux is more secure than a closed one like AIX because 'if he is hacked, he can do countermeasures'.
I believe the opposite is the case - it's more secure if not everybody knows the kernel and is able to... (6 Replies)
Discussion started by: zxmaus
6 Replies
10. Post Here to Contact Site Administrators and Moderators
Hi my thread here was deemed to be a homework question and subsequently closed by a mod. I don't know how to prove that this has nothing to do with homework. I'm 35, out of work for 18 months. I have a Qnap TS209 and I have a folder on it with a ton of roms (as in games) that I want to compress to... (4 Replies)
Hello all,
I am trying to edit a file using VI on hp-ux....but when i try to open the file using vi <filename> it dose not let me open up the right way...it just messes up the whole file....i cant even read that file...so for example...here is a file i created test1.txt...when i cat... (6 Replies)
Hi,
I have this problem on how to place the cursor in a text editor (for example: pico).
I made this script that would attach comments to a script file then open the script file,
I would like to know how to place the cursor in a specific place,
for example at the end of the comments,
... (1 Reply)
Hi All,
I have cursor which is about to fetch 4,00,000 records and then I am performing the action in cursor.
I am running this sql using unix script.
But after some time , I see the job is no more exists but sql is also not completed.
what might be the reason. (1 Reply)
Hi Gurus,
I have an input like the one below. What i wanted to achieved is to create a select statement based from that information
INPUTInsert into table_name (col1,col2,col3,col4,col5,DATE1,DATE2,col6,col7,col8,col9,col10,col11) values (6752,14932156,24,'ALL','Staff',to_date('04/17/2017... (6 Replies)