Oledb Transaction issue

G

Guest

I am attempting to get the maximum value from a specific table (select max(id) from transactions) and it seems to work... that is until you do the following
- select the maximu
- insert a new record (meaning the id is increased
- select the maximum again
When done through an oledb transaction the first and last selects return the same value, when they should clearly not
I am connecting to an Oracle 8i DB, and using SQL plus doing the same thing (select, insert, select, commit/rollback) it will give the correct answers

Is there an easy way to get around this problem

Cheer
Martin
 
K

Kevin Yu [MSFT]

Hi Martin,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you get the same result of maximum ID
before and after adding a new record to the table. If there is any
misunderstanding, please feel free to let me know.

Since you are executing these three steps in a transaction, the second
select might be happen before the insertion is commited. So the newly
inserted recored cannot be seen by the second select. Have you tried it
without the transaction or select the maximum again after the trasaction is
committed?

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
K

Kevin Yu [MSFT]

Hi Martin,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top