Re: problem with date in oracle 10g

From: <narayani16_at_gmail.com>
Date: Fri, 4 Jan 2008 05:23:37 -0800 (PST)
Message-ID: <6cedc41f-1450-4f2c-aedf-ca4eb4aa8e94@l58g2000hsa.googlegroups.com>


Hi All,

    I have a doubt. I am writing a function which has to get the greatest date value among the columns in a row. say there are 5 columns. I have to get the greatest date of those 5 columns and display the result.

There might be chance that the date values might be null. In case if some two column values are null and other three have some date values i need to get the greatest of those three.

In case if all are null the result will be null. Please some one help me in writing the function in Oracle to get the greatest date from 7 parameters passed inside which are all of Type Date.

Say the input is

Date1	    Date2	        Date3       Date4        Date5
Date6	Date7
12/12/2008  01/01/2007       null	         null	       3/3/2006
10/10/2008	null
null	      null	         null	     3/09/2004    null	           null
null
01/04/2006      null	         null	         null
4/04/2006        null	null


The ouput should be like this

Date
12/12/2008
3/09/2004
4/04/2006

Please some one give me a way for this. Received on Fri Jan 04 2008 - 07:23:37 CST

Original text of this message