ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by sinys » Thu 08 Aug 2013 18:03

Delphi XE2, ODAC 9.0.2
ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

OraQuery1.Opetions.StrictUpdate := True;

1) create table simple_table (id number);
2) fill it with 1, 1 . Commit.
3) Update In grid 1 => 2
4) Update failed. Found 2 records - It's OK, but SQL Monitor showing
ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid
5) Commit;
6) Another session: select * from simple_table
show 2,2 instead of the expected 1, 1

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by AlexP » Fri 09 Aug 2013 09:03

Hello,

Thank you for the information. We have reproduced the problem and will investigate the reasons of such behaviour.

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by sinys » Sun 11 Aug 2013 17:40

If I change LockMode to lmLockImmediate then it's work fine, but I get message "Refresh failed. Found 2 records", why 'Refresh' if it Update operation?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by AlexP » Mon 12 Aug 2013 09:27

Hello,

After updating a record we try to call the Refresh operation for the updated record, and since there are more than 1 such records in your case - we generate this error. To avoid this error, you should set the StrictUpdate property to False

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by sinys » Mon 12 Aug 2013 15:29

But in the first setuation I get "Update failed. Found 2 records" - it message more suitable.

>set the StrictUpdate property to False
I want to get this message when I update or delete more then 1 record, but I want to get the correct message for my operation. I do Update and get a message about Refresh - it's weird for my users.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by AlexP » Tue 13 Aug 2013 07:26

Hello,

You can handle this error and return your message, e.g., as follows:

Code: Select all

  try
    OraQuery1.Edit;
    OraQuery1.Fields[0].AsInteger := 2;
    OraQuery1.Post;
  except
    on E: EDatabaseError do
      if pos('Refresh failed. Found', e.Message) > 0 then        ShowMessage('Your message');
  end;
However, it will be more correct to use primary key in the table - in this case, only one record will be guaranteed updated

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by sinys » Tue 13 Aug 2013 10:53

However, it will be more correct to use primary key in the table - in this case, only one record will be guaranteed updated
I know it, but its presence is dependent on the end-user query.
on E: EDatabaseError do
if pos('Refresh failed. Found', e.Message) > 0 then ShowMessage('Your message');
I think it's can be potentially dangerous because you can change this message in future or you can use this message for another operation (like Delete may be, I didn't check it, sorry)

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by AlexP » Thu 15 Aug 2013 11:01

Hello,

You can add a ROWID field to user queries and use it as KeyField for unique record identification.
We will consider the possibility to modify the error message in one of the next versions.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ORA-01086: savepoint 'LOCK_ORAQUERY1' never established in this session or is invalid

Post by AlexP » Mon 16 Sep 2013 11:19

Hello,

We have fixed the behaviour: now, ROLBACK is not called on error occurrence if a Savepoint wasn't set before that.

Post Reply