ij Commands and Errors Reference,
Page 17 of 37


[top]
[prev]
[next]
Documentation Top
Index for This Book

Absolute
After Last
Async
Autocommit
Before First
Close
Commit
Connect
Disconnect
Driver
Elapsedtime
Execute
Exit
First
Get Cursor
Get Scroll Insensitive Cursor
Help
Last
MaximumDisplayWidth
Next
Prepare
Previous
Protocol
Readonly
Relative
Remove
Rollback
Run
Set Connection
Show Connections
Wait For

Get Cursor

Syntax

GET CURSOR Identifier AS String

Description

Creates a cursor with the name of the Identifier by issuing a java.sql.Statement.executeQuery request on the value of the String.

If the String is a statement that does not generate a result set, the behavior of the underlying database determines whether an empty result set or an error is issued. If there is an error in executing the statement, no cursor is created.

ij sets the cursor name using a java.sql.Statement.setCursorName request. Behavior with respect to duplicate cursor names is controlled by the underlying database. Cloudscape does not allow multiple open cursors with the same name.

Once a cursor has been created, the ij Next and Close commands can be used to step through its rows, and if the connection supports positioned update and delete commands, they can be issued to alter the rows.

Example

 ij> -- autocommit needs to be off so that the positioned update
 ij> -- can see the cursor it operates against. 
 ij> autocommit off;
 ij> get cursor menuCursor as
'SELECT * FROM menu FOR UPDATE OF price';
ij> next menuCursor; COURSE    |ITEM                |PRICE           ----------------------------------------------- entree    |lamb chop           |14              ij> next menuCursor; COURSE    |ITEM                |PRICE           ----------------------------------------------- dessert   |creme brulee        |6               ij> UPDATE SET price=price+1 WHERE CURRENT OF menuCursor; 1 row inserted/updated/deleted ij> next menuCursor; COURSE    |ITEM                |PRICE           ----------------------------------------------- appetizer |baby greens salad   |7               ij> close menuCursor; ij> commit; ij>
[top]
[prev]
[next]


Cloudscape Version 3.0
For technical support, go to: www.cloudscape.com and click Support.
Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved.