Oracle Database DifferencesIf you come from an OpenSource database background (MySql/PostgreSql), there will be certain things that require workarounds for use with OracleDatabases.
Here's the list so far:
If you don't like:
If you wish you could:
select * from foo limit 10Instead, do this:
select * from foo where rownum <= 10(SQL is designed to give you complete result sets. Automatic truncation at some particular size tends to be a non-standard extension. In fact, the above query returns the first 10 rows of the table foo in an arbitrary and not always predictable order.)
In Oracle8i, release 8.1 and up, you can use order by in a subquery. Therefore, to return the top two salaries of each department, using the class oracle table EMP:
select sal, deptno
from ( select sal, deptno
from emp
order by SAL desc )
where rownum <= 2
order by deptno, sal
See also: http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:495221712170 for more discussion on "limit" type queries using modern versions of Oracle databases.
If you wish you could:
Or use a trigger, with the INSERT statement using the RETURNING option. See also: http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:500421805606
EditText of this page
(last edited April 20, 2009)
or FindPage with title or text search