Row Lock

Database
Enthusiast

Row Lock

Hi

I have requirement to lock the Rows whatever the rows i read. and need to release the lock before updating those rows.

As i am reading the table and updating the same table in single process. So there should not be any process do any transformation on particular rows between Read and Update time.

Can Somebody advise on this?

2 REPLIES
Enthusiast

Re: Row Lock

I am not sure I exaclty got your problem.

But if you are updating a table then Teradata will automatically will lock it so that no other process can write over it.

However if you want to read rows from those table you can precede your sql with LOCKING OW FOR ACCESS cmd

Enthusiast

Re: Row Lock

May be you can use this If I get you correct

BT

Locking row for write select * from tableA; --- to read --------

Update tableA

........................................;

ET

or you can use multistatement request like

Locking row for write select * from tableA

;

Update tableA

........................................;

HTH

Harpreet