Sql updating a table from itself sex dating in merrillville indiana
Thanks for your help March 24, 2004 - am UTC commit; rollback; thats the only way to release locks gained by SQL like that.you "grow" locks in your transaction and you give them all up when the transaction finishes.I Tom, I Have this PL/SQL in ORACLE 10g (Red Had)....
It does this since you read the row out at time T1 and you delete it at time T2. There are no TX (transaction) locks -- hence no rows are locked in that table.
if that returns 0 rows, you are told that the data has been modified -- you need to requery if that returns 1 row, you have the row locked and will be able to delete it and no one else can touch it. If you do not need to inspect the data BEFORE doing the delete, you do not need this logic in general. In your explanation you refered to variant(database column), what do u mean by variant? December 19, 2002 - am UTC meaning the value varies from row to row.
If you need to inspect the data before the delete -- YOU NEED this logic (to ensure the data does not change under the covers). select * from t where column1 = column2; there -- column2 is "variable" when compared to column1.
FOR UPDATE; begin for x in c1 loop some procedural code to look at X if ( some condition based on X ) then delete where current of c1; end if; end loop; end; you really do need the select for update to ensure that no one else updates your data. Now - either sessions would give the following result SQL select empno, ename, job from emp where empno=7369; EMPNO ENAME JOB ---------- ---------- --------- 7369 SMITH2 CLERK Isn't this a case of lost update ?
Select for update is a programming tool -- use it when you need to. (not every transcation was using a for update nowait) April 09, 2003 - am UTC yes it is -- your application code is incorrect.