Skip to Content
avatar image
Former Member

What is the behavior of SELECT FOR UPDATE cursor?

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    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 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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks a lot Lars for these details.

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

      Seb