Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Re: Rownum
That's correct, there's no rownum of 0.
ex.
SQL> select rownum, username from dba_users;
ROWNUM USERNAME
---------- ------------------------------ 1 SYS 2 SYSTEM 3 OUTLN 4 OEM_DLAND 5 DBSNMP 6 HR 7 PM 8 DLANDRUM 9 OE 10 WMSYS 11 ORDSYS 12 ORDPLUGINS 13 MDSYS 14 CTXSYS 15 QS_CS 16 QS_CB 17 QS_CBADM 18 QS_OS 19 QS_ES 20 QS_WS 21 QS 22 QS_ADM 23 SH 24 XDB 25 ANONYMOUS 26 WKSYS 27 WKPROXY 28 ODM 29 ODM_MTR 30 OLAPSYS
30 rows selected.
I'm not sure what you mean by 'judge the select return', but the only real use I can think of for rownum is to restrict your query to a small random sampling of your data...
ex.
SQL> select table_name, tablespace_name from dba_tables
2 where rownum < 5;
TABLE_NAME TABLESPACE_NAME ------------------------------ ------------------------------ SEG$ SYSTEM CLU$ SYSTEM OBJ$ SYSTEM FILE$ SYSTEM
>>> liujd_at_cti.ac.cn 03/19/03 08:33AM >>>
Darrell Landrum,-? +úí
thanx for your explaination.
I wonder :whether i can judge the select return.
I find the rowNUM is not 0, is right?
>Santosh,
>
>Good question. Actually these 2 are not related.
>Rowid is an actual attribute assigned to each row of a table and is unique.
>Rownum is logically assigned to rows returned in a query (nothing to do with the table). It is assigned sequentially as rows are returned (meaning if you can't have a rownum 2 until you've gotten a rownum 1).
>
>Ex.
>SQL> select rowid from dual;
>
>ROWID
>------------------
>AAAACsAABAAAAGkAAA
>
>SQL> select rownum from dual;
>
> ROWNUM
>----------
> 1
>
>SQL> select rownum from dual where rownum=2;
>
>no rows selected
>
>SQL> select rownum from dual where rownum < 2;
>
> ROWNUM
>----------
> 1
>
>
>Hope this was helpful,
>Darrell
>
>
>
>
>>>> vsantosh_at_psi.soft.net 03/19/03 03:43AM >>>
>Hello list,
>
> I wanted to know the concept of Rownum.. Is it similar to Row Id ?
>
>Thanks and Regards,
>Santosh
>
>
>----------------------------------------------------------------------------
>----
>
>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.net
>--
>Author: Darrell Landrum
> INET: dlandrum_at_zalecorp.com
>
>Fat City Network Services -- 858-538-5051 http://www.fatcity.com
>San Diego, California -- Mailing list and web hosting services
>---------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).
íííííííííííííííí+-
íííííííííííííííí-)+ ½ ííííííííííííííííliujd_at_cti.ac.cn íííííííííííííííííííí2003-03-19
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: =?GB2312?Q?=C1=F5=BC=CC=B6=AB?= INET: liujd_at_cti.ac.cn Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Wed Mar 19 2003 - 09:58:21 CST
![]() |
![]() |