Is there an option to lock a record in Oracle No Sql (like a row lock in RDBMS)?

154 Views Asked by At

I am wondering if there is an option to lock a record in Oracle NoSql in a safe way (like a row lock in RDBMS)? is it recommended?

We need to read a record, do some modifications, and update the record with the new data. We want to be sure that other users are not doing updates to the record during this process.

1

There are 1 best solutions below

0
John Connelly On

Oracle NoSQL supports a notion of 'record version' which allows you to tell if a record has been modified between a get and a subsequent put operation. You can get the version from the GetResult and pass that to setMatchVersion() in the PutRequest to have the put fail if the record version does not match. See https://docs.oracle.com/en/cloud/paas/nosql-cloud/csnjv/oracle/nosql/driver/ops/PutRequest.html#setMatchVersion(oracle.nosql.driver.Version) for details.