I am accessing a table in the Oracle 12C to generate unique reference number from the table and update the next number to the same row. At the same time, more than 3 application is accessing the same table for the reference number. Is there any way to lock the Reading of the table while I am accessing the connection using query. I have tried the following query.
LOCK TABLE UPS_HDR_SEQ IN SHARE ROW EXCLUSIVE MODE;
select max(SEQN) From UPS_HDR_SEQ where SRV_ID=?;
But it is only allowing the User Lock the connection during the committing of a transaction. During that time any other application can read the data gets the reference number. In this case, the other application can also get reference number same as my reference number. Is it Possible to implement Read lock of the table Using Query?