Select with rownum : rownum « Query Select « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » Query Select » rownum 
2. 31. 1. Select with rownum
SQL>
SQL> CREATE TABLE s_inventory
  2  (product_id               NUMBER(7),
  3   warehouse_id             NUMBER(7),
  4   amount_in_stock          NUMBER(9),
  5   reorder_point            NUMBER(9),
  6   max_in_stock             NUMBER(9),
  7   out_of_stock_explanation VARCHAR2(255),
  8   restock_date             DATE);

Table created.

SQL>
SQL> INSERT INTO s_inventory VALUES (100111016506251100, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (100121016005601000, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (10013101400400700, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (10021101500425740, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (10022101300200350, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (10023101400300525, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (201061019936251000, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (201081017007001225, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (202011018028001400, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (2051010113898501400, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (205121018508501450, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (30321101200015002500, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (30326101210020003500, NULL, NULL);

row created.

SQL> INSERT INTO s_inventory VALUES (30421101182218003150, NULL, NULL);

row created.

SQL>
SQL>
SQL> SELECT product_id
  2  FROM   s_inventory
  3  WHERE  ROWNUM < 5;

PRODUCT_ID
----------
     10011
     10012
     10013
     10021

SQL>
SQL>
SQL> drop table s_inventory;

Table dropped.

SQL>
2. 31. rownum
2. 31. 1. Select with rownum
2. 31. 2. Use rownum to limit the resultset
2. 31. 3. SELECTs using the ORDER BY clause with rownum
2. 31. 4. Getting the Five Most Expensive Products
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.