REcord is locked by another user

demo

Member
I have the error 'record is locked by another user' when I am only the user logged in. At run time when I edit a record and post it I receive this error. That's not the case with all tables I have, but I can not understand why this happening.

I have only one session in my program and no connection at design time. I checked in oracle that there is only one session active.

I tried different LockingMode - result is the same. I turned Debug to True and there was interesting information.
Here is debug info I have:
1) on opening: SELECT *, rowid FROM ....
2) on edit: SELECT * FROM ... WHERE rowid=...
3) on Post: SAVEPOINT
SELECT * FROM ... WHERE rowid=... FOR UPDATE NOWAIT
UPDATE ... SET ... WHERE rowid=...
Here the error message comes out! I don't understand why. It seems I locked the record successfully with SELECT FOR UPDATE and then I cannot update it! looks like SELECT FOR UDATE and UPDATE are performed in different sessions, but I checked with Oracle that I have only one session right before UPDATE statement.
I have Delphi5, DOA 3.4.5, Oracle 8.1.7.0.0
What the problem?

Alex

------------------
 
Can you verify with the Oracle Monitor what the result of the select for update and the actual update is (error codes, number of rows processed)?

------------------
Marco Kalter
Allround Automations
 
Right. I forgot about this tool.
smile.gif

Here is log for this operations. Please note, that for UPDATE 0 records processed and no error. It seems something wrong with ROWID... I checked the variables - ROWID is the same in all statements.

Query.Execute (1 record processed) select * from PM.PROD_CYCLES where rowid = :doa__rowid

Query.Execute savepoint DOA__LOCKPOINT

Query.Execute (1 record processed) select * from PM.PROD_CYCLES where rowid = :doa__rowid for update nowait

Query.Execute (0 records processed) update PM.PROD_CYCLES set CYCLE_ID = :CYCLE_ID where rowid = :doa__rowid

Query.Execute rollback to savepoint DOA__LOCKPOINT

Thanks!
Alex

[This message has been edited by demo (edited 23 November 2001).]
 
Strange... I disabled all constraints, triggers, foreign keys. ROWID looks to be fine... at least I can update this row from SQL*Plus using that ROWID.
DOA__ROWID AAAF5IAADAAAAOzAAA

Alex
 
I was having a very similar problem and found the solution to my problem was changing BytesPerCharacter from the default to bcAutoDetect (In the TOracleSession). For some reason the deafault is bc1Byte (I'm using C++ Builder 5.0 with patch 1)
 
You are right. I set the BytesPerCharacer to bcAutoDetect in Delphi 6. And work fine. I sloved my problems.

Before I saw this post, I have the problems below :
1, When I update Numerical field, it said lock by another user.
2, When I update character field, it said ORA-01461: can bind a LONG value only for insert into LONG column.
3, I change the fieldkind of the fields wich I will be edit(I found this method in the DOA's menu). Ok, I can update now. But only in the client site, there without changes in the server site.

But now I slove those by seting the BytesPerCharacters.
Cany anyone tell me why.

I am using
ChineseWindows2000 Pro.
Delphi 6 Enterprise.

Thanks
 
Back
Top