| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> Re: Question on select count()
After exactly 51 inserts into a freshly created table, count will exceed 50.
:-)
I don`t see what you`re getting at.
Notes: Committing after each insert will slow down your application.
If you don`t commit, others won`t see the rows inserted. So another process' "count" will not be affected, until you commit those inserts.
You shouldn`t do a count iteratively in a loop, until 50 rows have been inserted. Rather, count in your java code to keep trace of how many you`ve inserted.
What are you trying to achieve?
Syltrem
"JP Belanger" <jpbelang_at_hotmail.com> a écrit dans le message de
news:b399d6ce.0408131002.26efbf79_at_posting.google.com...
> I have a question on select count(), which may betray my lack of
> database knowledge. Here goes.
>
> I have java code driving a transaction which goes like this:
>
> select count(*) from table
>
> (Java code in the same transaction)
> if count < 50 then ...
>
> insert into table values(blahblah)
> commit;
>
> it seems that if many of these transactions are running concurrently,
> count could exceed 50 unless oracle locks the table for inserts or
> deletes.
>
> Am I getting this wrong ? Are there better solutions ?
Received on Fri Aug 13 2004 - 16:33:32 CDT
![]() |
![]() |