SQL Recipes
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 09-04-2007, 10:49 PM
ashish2345 ashish2345 is offline
Junior Member
 
Join Date: Sep 2007
Posts: 3
ashish2345 is on a distinguished road
Default ANY dialect question:

rownum in 9i


Hi friends

when ever i try to use rownum function other than < or <= it gives no row selected like


select * from emp where rownum=2;



select * from emp where rownum>=3;

no row selected while emp hav 14 rows..

plz reply
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

ANSWER(S):

  #2 (permalink)  
Old 09-06-2007, 03:50 PM
Unregistered
 
Posts: n/a
Default ANY answer. Re: rownum in 9i

plzzz reply
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-23-2007, 05:40 PM
shashi jain shashi jain is offline
Junior Member
 
Join Date: Sep 2007
Posts: 3
shashi jain is on a distinguished road
Lightbulb ANY answer. Re: rownum in 9i

hi ashish,
i am sending u a link
Filtering (WHERE) and Sorting Data (ORDER BY) in Oracle 9i > Filtering with the WHERE Clause
there's a heading TOP - N QUERIES
hope this will help u....

shashi jain

Last edited by shashi jain : 09-23-2007 at 05:45 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-03-2007, 12:03 PM
Unregistered
 
Posts: n/a
Default ANY answer. Re: rownum in 9i

when u execute the SQL statement it always execute with 1 as rownum.
for ex :
select * from emp where rownum>=3;
this statement, when executes first time rownum is 1.next time rownum is 2...soon.
Sequence of Steps for Executing above SQL Statement:

select * from emp where 1>=3; - True
select * from emp where 2>=3; - True
select * from emp where 3>=3; - True
select * from emp where 4>=3; - False

the query executes 3 times and 3 rows will dispaly.


but when run following statement ,
select * from emp where rownum=2;

Sequence of Steps for Executing above SQL Statement:

select * from emp where 1=2;which is false.
hence it returns 0 rows.

So Note that while Executing SQL Statement with Rownum it Always start from 1(i.e) first row..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-16-2007, 08:02 AM
kvijay6aa kvijay6aa is offline
Junior Member
 
Join Date: Oct 2007
Posts: 2
kvijay6aa is on a distinguished road
Default ANY answer. Re: rownum in 9i

frend
u cant use " =" operator with rownum
so u acn use either
> or <
till it wll be fine




Quote:
Originally Posted by ashish2345 View Post
Hi friends

when ever i try to use rownum function other than < or <= it gives no row selected like


select * from emp where rownum=2;



select * from emp where rownum>=3;

no row selected while emp hav 14 rows..

plz reply
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:55 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2008 SQL Recipes

1 2 3 4 5 6 7 8