The table has 3 columns 4 rows. The output is which column has least null values( A COL SHOULD BE THE OUTPUT)
Write the query plz.

A B C
----------
1 NULL 7
2 4 NULL
NULL 5 NULL
3 NULL NULL

Answer Posted / rameshganesan

Select (Case
When a = Least Then (select 'O/P A ='||ListAgg(a,' ') Within Group(order by a) from Least_Col)
When b =Least Then (select 'O/P B ='||ListAgg(b,' ') Within Group(order by b) from Least_Col)
Else (select 'O/P C ='||ListAgg(c,' ') Within Group(order by c) from Least_Col) end)ab
From (Select count(a) a,count(b) b,count(c) c,greatest(count(a),count(b),count(c)) Least From Least_Col);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

WHAT IS ecc 6.0

1671


material view and view disadvantages?

643


What are operators in oracle?

536


How we can able to import our own template (users designed MS-Word templates) which has many tabular columns; need to pass some values generate by Oracle-reports9i? Actually need to import more than 400 MS-Word templates into Oracle Reports-9i to minimize layout design in Reports.

1625


Explain the use of analyse option in exp command.

597






Explain table?

668


What is background process in Oracle?

636


How to get a create statement for an existing table?

583


When do you get a .pll extension in oracle? Explain its importance

580


What are the uses of a database trigger?

530


How can I introduce multiple conditions in like operator?

564


How do I use os authentication with weblogic jdriver for oracle and connection pools?

587


Explain a synonym?

614


What is the difference between truncate & delete command?

630


How to use "in out" parameter properly?

627