Question : format as date

I have a table called sales_header with an entry called order_date that returns a number.  I would like this number formatted as a date but using something like:
select to_date(order_date, 'DD-MON-YYYY HH24:MI:SS') as orderdate from sales_header
where sales_document_num = 33303
gives an error, presumably because to_date expects a string.  After this I tried
select to_date(to_char(order_date), 'DD-MON-YYYY HH24:MI:SS') as orderdate from sales_header
where sales_document_num = 33303
but this gives the same error (ORA-01861: literal does not match format string)
The only way I have of doign what I want at the moment is:
select to_date('01-JAN-1970 00:00:00', 'DD-MON-YYYY HH24:MI:SS') + NUMTODSINTERVAL(order_date,'SECOND') as orderdate
from sales_header
where sales_document_num = 33303
but I wanted a more elegant solution
Any ideas?  
Thanks

Answer : format as date


select to_char(TO_DATE('19700101000000','YYYYMMDDHH24MISS')+ NUMTODSINTERVAL(1245854805, 'SECOND'),'DD-MON-YYYY HH24:MI:SS') from dual

will give u in desired format
 

shru_0409 : order date is defined in unix epoch time...

1245854805 the number indicated the number of seconds elapese since 01-january-1970 00:00:00'


Random Solutions  
 
programming4us programming4us