How can u find column name from a table which have max value
in a row.( not max value)

Answer Posted / gaurav

select decode( (select sal from emp where empno = 7521) , (select greatest( sal, comm ) from emp where empno = 7521 ), 'sal', 'comm' ) from dual

You can use multiple decode if more number of columns are there.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is loop in pl sql?

666


Is postgresql a nosql database?

649


The select into statement is most often used to create backup copies of tables or for archiving records?

666


Is merge a dml statement?

627


Does google use sql?

598






What is a column in a table?

662


What is the benefit of foreign key?

621


how to get a list of columns in an existing table? : Sql dba

633


What is data control language?

634


What is a mutating table and a constraining table?

665


How bulk collect improves performance?

648


What are the dml statements?

775


What is a recursive join sql?

694


what is single byte over head in oracle..?

1970


Is there a pl/sql pragma similar to deterministic, but for the scope of one single sql select?

637