radu florescu
radu florescu

Reputation: 4363

Oracle Cursor vs. SQL Server Cursor

I am a newbie in Oracle and I was wondering if Oracle has options for cursors like SQLSERVER. Like this ones:

[ LOCAL | GLOBAL ]
[ FORWARD_ONLY | SCROLL ]
[ STATIC | KEYSET | DYNAMIC | FAST_FORWARD ]
[ READ_ONLY | SCROLL_LOCKS | OPTIMISTIC ]
[ TYPE_WARNING ]
FOR select_statement
[ FOR UPDATE [ OF column_name [ ,...n ] ] ]

Please post some links where I could read on how to use them or code examples.

Upvotes: 1

Views: 4256

Answers (2)

APC
APC

Reputation: 146239

Explicit cursors in Oracle don't have metadata associated with them. The following is a translation, putting Oracle's behaviour into a T-SQL context.

Oracle cursors do not support scrolling. So they are FORWARD_ONLY, no discussion. This means SCROLL, FAST_FORWARD, SCROLL_LOCKS and KEYSET do not apply.

All Oracle cursors are LOCAL.

Because of Oracle's isolation level, the cursors are the equivalent of INSENSITIVE and STATIC.

Cursors are OPTIMISTIC unless we use the FOR UPDATE SQL syntax, which locks the selected row(s). Find out more

Cursors are READ_ONLY. They are for fetching data only. We can use the WHERE CURRENT OF syntax to update a row identified by a cursor. This is best used in conjunction with FOR UPDATE. Find out more.

You won't be surprised to learn that TYPE_WARNING doesn't apply (because nothing else does).

Upvotes: 10

aF.
aF.

Reputation: 66697

All that info can be found HERE and specially HERE or HERE.

Upvotes: 0

Related Questions