This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM user WHERE username LIKE 'a%' LIMIT 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR at line 1: | |
ORA-00933: SQL command not properly ended |
For each row returned by a query, the ROWNUM pseudocolumn returns a number indicating the order in which Oracle 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.Například:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM user WHERE first_name LIKE 'a%' and ROWNUM <= 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM user WHERE first_name LIKE 'a%' and ROWNUM <= 10 ORDER BY age; |
Správný postup je původní dotaz vnořit do nového, který přidá podmínku s ROWNUM:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM | |
(SELECT * FROM user WHERE username LIKE 'a%' ORDER BY age) | |
WHERE ROWNUM <= 10; |
http://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns009.htm
http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html
Žádné komentáře:
Okomentovat