|
|
Archives of the TeradataForum
Message Posted: Fri, 30 Sep 2005 @ 08:50:22 GMT
Subj: | | Re: Error trapping a deadlock inside Bteq? |
|
From: | | Vinod Sugur |
Hi Mike,
To prevent deadlock we can use Lock with Nowait option, so whenever a query place a lock on another table and if that table is used by some
other SQL statement exclusively then our query will abort.
---------------------------------------------------------
lock table vin_temp for write nowait
select * from vin_Temp;
*** Failure 7423 Object already locked and NOWAIT. Transaction Aborted.
Statement# 1, Info =0
*** Total elapsed time was 1 second.
+---------+---------+---------+---------+---------+---------+
.IF ERRORCODE > 0 THEN .QUIT 22;
.QUIT 22;
*** You are now logged off from the DBC.
*** Exiting BTEQ...
*** RC (return code) = 22
---------------------------------------------------------
I hope this helps.
Regards,
Vinod
| |