cancel
Showing results for 
Search instead for 
Did you mean: 

What is the behavior of SELECT FOR UPDATE cursor?

sebflaesch
Explorer
0 Kudos

Using SAP HANA 2 ODBC client, executing a cursor with SELECT FOR UPDATE, I want to compare the behavior with other database engines regarding concurrent data access when another client process does the same...

  1. Must be in a TX block? (does SELECT FOR UPDATE start a TX?)
  2. Lock granularity? (table level / data block / row / variable-granularity)?
  3. Release locks when cursor is closed?

Where can I find documentation about this?

Seb

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor

Technically, every SQL command runs in a transaction and so does SELECT FOR UPDATE.

The semantic is that SELECT FOR UPDATE sets exclusive locks (others can still read, but not write) on all rows returned by the query. Locks in HANA are always either on row level or - if demanded by the command semantics - on table level.

As usual, locks are released with a commit or a rollback and also when you close a cursor.

The documentation is on help.sap.com. And your questions are covered in it.

I noted that you seem to have a lot of questions, but never bother to close them. That's not exactly motivating anyone to answer your questions.

Cheers,

Lars

sebflaesch
Explorer
0 Kudos

Thanks a lot Lars for these details.

Sorry I don't know how to close questions, have marked your answer as "accepted".

Seb

Answers (0)