Oracle cheat sheet

Posted by s1mple on Dec 30, 2008 in IT, Tips & Triks |

- SQLPlus short connection
sqlplus <username>/<password>@<ipAddress>:<port>/<sid> [@<scriptfile>]

Ex:
sqlplus user/pass@192.168.1.10:3267/MYDB @test.sql

- MySQL limit equivalent
Ex:
SELECT last_name FROM
(SELECT last_name, ROW_NUMBER() OVER (ORDER BY last_name) R FROM employees)
WHERE R BETWEEN 51 and 100;

Alternative:
select *
from ( select a.*, rownum rnum
from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
where rownum <= MAX_ROWS )
where rnum >= MIN_ROWS;

Tags:

Leave a Reply

XHTML: You can use these tags:' <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2010 Simple Difference All rights reserved.
Desk Mess Mirrored v1.4.3.1 theme from BuyNowShop.com.