Go4Oracle

Member Login






Powered by CodeRevolts
You are here  :Home arrow Articles arrow Oracle arrow rownum a pseudocolumn
rownum a pseudocolumn E-mail
(0 votes)
Written by ankur   
Sunday, 14 September 2008
 

Views : 246    


Rownum :- Rownum is a pseudocolumns.  A pseudocolumn behaves like a table column but is not actually stored in the table. You cannot insert or delete values of the pseudocolumns. 

 

For each row returned by a query, the ROWNUM pseudocolumn returns a number indicating the order in which Oracle server selects the row from a table or set of joined rows. The first row selected has a ROWNUM of 1, the second has 2, and so on.Rownum can be used to limit the number of rows retieved.

 

Example

SELECT empno, ename, job FROM emp WHERE ROWNUM < 5;

Output

empno | ename | job

7521 | WARD | SALESMAN

7566 | JONES | MANAGER

7654 | MARTIN | SALESMAN

7698 | BLAKE | MANAGER

(4 rows)





Reddit!Del.icio.us!Google!Live!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Smarking!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites! title=

   

Users' Comments  
 

Average user rating

   (0 vote)

 

Display 1 of 1 comments

rownum are very usefula feature

By: amal (Registered) on 05-10-2008 19:15

rownum are very usefula feature

By: amal (Registered ) on 05-10-2008 19:15

rownums can also be used for exceptions handling...a simple case may be in a PLSQL Exception too_many_rows. 
Eg. Select col into variable from tablename 
where colname = 'Some Values' this can return multiple records and we can come across exception too_many_rows....  
If we modify the above with following then we are assured that the plsql statement will never encounter too_many_rows exception 
 
Select col into variable from tablename 
where colname = 'Some Values'  
and rownum =1

 

Display 1 of 1 comments



Add your comment
Name
E-mail
Title  
 
Comment
 
Available characters: 600
   Notify me of follow-up comments
  Mathguard security question:
IAE         A5T      
G      3    3 H   BUW
CQ3   125   XQQ      
  M    8    7 E   4H9
HS1         ICA      
   
   

< Prev   Next >
Register Now

Bookmark Us

 
 

Who's Online

No Users Online

Advertisement

Linux Indore - 2007

Hello, you either have JavaScript turned off or an old version of Macromedia's Flash Player. Get the latest flash player.

Most Commented Items

Basic Cursor Writing
(1 comment)
Files that control oracle inst
(1 comment)
ROWID OF A RECORD (PSUEDO COLU
(1 comment)
rownum a pseudocolumn
(1 comment)

Visitors Counter

mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday49
mod_vvisit_counterYesterday104
mod_vvisit_counterThis week153
mod_vvisit_counterThis month516
mod_vvisit_counterAll22670

Our Recommendations

Get Firefox browser!
Go to Google!Get a free mail account!Get The Gimp!Get Openoffice!Get Videolan!