One possibility
lh, March 18, 2018 - 2:05 pm UTC
something like:
select
sal
from (
select sal from emp order by sal desc
) where rownum =1
March 19, 2018 - 4:46 am UTC
You have TWO select statements there.
A reader, March 19, 2018 - 7:25 am UTC
But Oracle doesn't mention the max(-Column_name) in PLSQL documentation?
Why?
Just in case all numbers are negative
Stew Ashton, March 19, 2018 - 10:11 am UTC
with data as (select -1 n from dual)
select max(n),
abs(min(-n)),
-min(-n)
from data;
MAX(N) ABS(MIN(-N)) -MIN(-N)
---------- ------------ ----------
-1 1 -1
March 21, 2018 - 11:05 am UTC
When the column "salary" goes negative, I've got other concerns :-)
To: a reader
Stew Ashton, March 19, 2018 - 10:18 am UTC
You say "But Oracle doesn't mention the max(-Column_name) in PLSQL documentation?
Why?"
First of all, you mean min not max.
Second, this is a SQL statement, not PLSQL.
Third, the documentation talks about min, and it talks about the minus sign "-". Putting the two together is our job.
Fourth, are you a plant by Russians to destroy Oracle by frustrating the askTOM team into shutting down this site? FAKE QUESTION!
March 21, 2018 - 11:05 am UTC
:-)
Now you tell me.
Chuck Jolley, March 19, 2018 - 8:42 pm UTC
After twenty years writing Oracle sql I learn that I can just stick a minus sign on the front of a numeric column to negate it?
I'll bet I've written -1 * col a thousand times to convert accounting entries to credit values.
Learn something new every day.
March 21, 2018 - 11:06 am UTC
That's why I love working on AskTOM