User rownum to get only first 200 records : ROWNUM « Table « Oracle PL / SQL






User rownum to get only first 200 records



SQL>
SQL> select owner, table_name
  2        from all_tables
  3        where rownum < 200
  4        order by owner, table_name ;

OWNER                          TABLE_NAME
------------------------------ ------------------------------
OUTLN                          OL$
OUTLN                          OL$HINTS
OUTLN                          OL$NODES
SYS                            ACCESS$
SYS                            ARGUMENT$
SYS                            ASSOCIATION$
SYS                            ATTRCOL$
SYS                            ATTRIBUTE$
SYS                            AUDIT$
SYS                            BOOTSTRAP$
SYS                            CCOL$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            CDC_CHANGE_SETS$
SYS                            CDC_CHANGE_SOURCES$
SYS                            CDC_SYSTEM$
SYS                            CDEF$
SYS                            CLU$
SYS                            COL$
SYS                            COLLECTION$
SYS                            COLTYPE$
SYS                            COL_USAGE$
SYS                            COM$
SYS                            CON$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            CONTEXT$
SYS                            DEFROLE$
SYS                            DEFSUBPART$
SYS                            DEFSUBPARTLOB$
SYS                            DEPENDENCY$
SYS                            DIM$
SYS                            DIMATTR$
SYS                            DIMJOINKEY$
SYS                            DIMLEVEL$
SYS                            DIMLEVELKEY$
SYS                            DIR$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            DUAL
SYS                            DUC$
SYS                            ERROR$
SYS                            EXPACT$
SYS                            EXPDEPACT$
SYS                            EXPDEPOBJ$
SYS                            EXPPKGACT$
SYS                            EXPPKGOBJ$
SYS                            EXTERNAL_LOCATION$
SYS                            EXTERNAL_TAB$
SYS                            FET$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            FILE$
SYS                            HIER$
SYS                            HIERLEVEL$
SYS                            HISTGRM$
SYS                            HIST_HEAD$
SYS                            ICOL$
SYS                            ICOLDEP$
SYS                            IDL_CHAR$
SYS                            IDL_SB4$
SYS                            IDL_UB1$
SYS                            IDL_UB2$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            ID_GENS$
SYS                            INCEXP
SYS                            INCFIL
SYS                            INCVID
SYS                            IND$
SYS                            INDARRAYTYPE$
SYS                            INDCOMPART$
SYS                            INDOP$
SYS                            INDPART$
SYS                            INDPART_PARAM$
SYS                            INDSUBPART$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            INDTYPES$
SYS                            JAVAOBJ$
SYS                            JAVASNM$
SYS                            JOB$
SYS                            KOPM$
SYS                            LIBRARY$
SYS                            LINK$
SYS                            LOB$
SYS                            LOBCOMPPART$
SYS                            LOBFRAG$
SYS                            METAFILTER$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            METANAMETRANS$
SYS                            METAPATHMAP$
SYS                            METASCRIPT$
SYS                            METASCRIPTFILTER$
SYS                            METASTYLESHEET
SYS                            METAVIEW$
SYS                            METAXSL$
SYS                            METAXSLPARAM$
SYS                            METHOD$
SYS                            MIGRATE$
SYS                            MLOG$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            MLOG_REFCOL$
SYS                            MON_MODS$
SYS                            MON_MODS_ALL$
SYS                            NOEXP$
SYS                            NTAB$
SYS                            OBJ$
SYS                            OBJAUTH$
SYS                            OBJPRIV$
SYS                            OID$
SYS                            OPANCILLARY$
SYS                            OPARG$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            OPBINDING$
SYS                            OPERATOR$
SYS                            OPQTYPE$
SYS                            PARAMETER$
SYS                            PARTCOL$
SYS                            PARTLOB$
SYS                            PARTOBJ$
SYS                            PENDING_SESSIONS$
SYS                            PENDING_SUB_SESSIONS$
SYS                            PENDING_TRANS$
SYS                            PROCEDURE$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            PROCEDUREC$
SYS                            PROCEDUREINFO$
SYS                            PROCEDUREJAVA$
SYS                            PROCEDUREPLSQL$
SYS                            PROFILE$
SYS                            PROFNAME$
SYS                            PROPS$
SYS                            PROXY_DATA$
SYS                            PROXY_ROLE_DATA$
SYS                            REFCON$
SYS                            REG_SNAP$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            RESOURCE_COST$
SYS                            RESOURCE_MAP
SYS                            RESULT$
SYS                            RGCHILD$
SYS                            RGROUP$
SYS                            RLS$
SYS                            RLS_CTX$
SYS                            RLS_GRP$
SYS                            RLS_SC$
SYS                            RULESET$
SYS                            SECOBJ$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            SEG$
SYS                            SEQ$
SYS                            SETTINGS$
SYS                            SLOG$
SYS                            SNAP$
SYS                            SNAP_COLMAP$
SYS                            SNAP_LOADERTIME$
SYS                            SNAP_LOGDEP$
SYS                            SNAP_OBJCOL$
SYS                            SNAP_REFOP$
SYS                            SNAP_REFTIME$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            SNAP_SITE$
SYS                            SOURCE$
SYS                            SQL$
SYS                            SQL$TEXT
SYS                            SQLPROF$
SYS                            SQLPROF$ATTR
SYS                            SQLPROF$DESC
SYS                            SQL_VERSION$
SYS                            STMT_AUDIT_OPTION_MAP
SYS                            SUBCOLTYPE$
SYS                            SUBPARTCOL$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            SUM$
SYS                            SUMAGG$
SYS                            SUMDELTA$
SYS                            SUMDEP$
SYS                            SUMDETAIL$
SYS                            SUMINLINE$
SYS                            SUMJOIN$
SYS                            SUMKEY$
SYS                            SUMPARTLOG$
SYS                            SUMPRED$
SYS                            SUMQB$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            SUPEROBJ$
SYS                            SYN$
SYS                            SYSAUTH$
SYS                            SYSTEM_PRIVILEGE_MAP
SYS                            TAB$
SYS                            TABCOMPART$
SYS                            TABLE_PRIVILEGE_MAP
SYS                            TABPART$
SYS                            TABSUBPART$
SYS                            TRIGGER$
SYS                            TRIGGERCOL$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            TRIGGERJAVAC$
SYS                            TRIGGERJAVAF$
SYS                            TRIGGERJAVAM$
SYS                            TRIGGERJAVAS$
SYS                            TRUSTED_LIST$
SYS                            TS$
SYS                            TSQ$
SYS                            TYPE$
SYS                            TYPED_VIEW$
SYS                            TYPEHIERARCHY$
SYS                            TYPE_MISC$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            UET$
SYS                            UGROUP$
SYS                            UNDO$
SYS                            USER$
SYS                            USER_ASTATUS_MAP
SYS                            USER_HISTORY$
SYS                            USTATS$
SYS                            VIEW$
SYS                            VIEWCON$
SYS                            VIEWTRCOL$
SYS                            VTABLE$

OWNER                          TABLE_NAME
------------------------------ ------------------------------
SYS                            _default_auditing_options_

199 rows selected.

SQL>
SQL>
SQL>
           
       








Related examples in the same category

1.Including the ROWNUM pseudo-column in the WHERE clause
2.Only list the first four rows using ROWNUM
3.The values for ROWNUM column are generated before the order by was applied
4.Select the Top 5