to find greatest value [message #21755] |
Wed, 28 August 2002 07:50 |
Victoria
Messages: 152 Registered: July 2002
|
Senior Member |
|
|
Hi,
I have one cursor fetching 100 columns per row.
all are same datatype.
Now i want to find the greatest & least value in the fetched columns for each row.....
Can any one tell me the simplest way to do that???
Thanks in advance
Victoria
|
|
|
Re: to find greatest value [message #21760 is a reply to message #21755] |
Wed, 28 August 2002 12:39 |
Su
Messages: 154 Registered: April 2002
|
Senior Member |
|
|
Check for GREATEST() and LEAST() functions in ORACLE.
For example, check the following.
SQL> select greatest(10,20) from dual;
GREATEST(10,20)
---------------
20
SQL> select least(10,20) from dual;
LEAST(10,20)
------------
10
SQL>
Hope this helps. Good luck :)
|
|
|
Re: to find greatest value [message #21762 is a reply to message #21755] |
Wed, 28 August 2002 13:11 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Not pretty but...
for r in (select * from t) loop
v_least := least(r.col1, r.col2, ..., r.col100);
v_greatest := greatest(r.col1, r.col2, ..., r.col100);
end loop;
|
|
|