Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SELECT...where ROWNUM > 1 doesn't work??

cayenneMay 22 2009 — edited May 23 2009
Hi all,

We're working to try to eventually update some rows on a table that an application has threads processing.
We're trying to basically update the value of one field it uses to 'mark' which is owned by that process.

while doing this, we were trying to just reset this field on some rows above where it is working. We tried using rownum.

This didn't work, so in trying to troubleshoot...we tried just a basic select to see if it would return any values to make sure rownum would work (dunno why it wouldn't).

If I try the following I get weird results

select count (*) from table1.

Returns like 13000 rows for a count.

I do this

select count (*) from table1 where rownum > 1

I get no rows.

The table has 13000 rows in it....

Now, if I do something like a select col1 from table1 where rownum < 10,
I get 9 rows...

I'm puzzled by this...

This originally came up with trying to update like I said, and was trying to do something like:

update table1 set field1 = 'value' where rownum between 1000 and 3000;

No rows updated.

I've not played with rownum in awhile, can someone give me some insight on what is going on here, or some links to info?

Thanks in advance,

cayenne
This post has been answered by Nicolas Gasparotto on May 22 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 20 2009
Added on May 22 2009
5 comments
2,380 views