Skip to Content

What is the behavior of SELECT FOR UPDATE cursor?

Sep 19, 2017 at 10:56 AM


avatar image

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?


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Lars Breddemann
Sep 22, 2017 at 01:09 AM

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 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.



Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks a lot Lars for these details.

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