minium over 4 numeric columns for each row in oracle

Hi:

I need to get the minimum value across 4 columns for each row in a table. Pseudocode is like:  
minimum (nvl(t.rating_A,0), nvl(t.rating_B,0), nvl(t.rating_C,0), nvl(t.rating_D,0)) as min_rating_over4cols_foreachrow

Is this possible with some sort of arithmetic function or something?
LuckyLucksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Look at LEAST:
http://docs.oracle.com/database/121/SQLRF/functions099.htm#SQLRF00657


least(nvl(t.rating_A,0), nvl(t.rating_B,0), nvl(t.rating_C,0), nvl(t.rating_D,0))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awking00Information Technology SpecialistCommented:
I think there could be a problem if the desired result is the minimum where any of the columns is not null. You might counter that with something like -
least(nvl(t.rating_A,9999999),nvl(t.rating_B,9999999), nvl(t.rating_C,9999999), nvl(t.rating_D,9999999)) where 9999999 is a number that will always be greater than any of the numbers in the 4 columns. What would you want to retrieve if all of the columns in a given row are null?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.