How about 

select to_char(floor(my_col_in_minutes/60), '990') || ':' ||
to_char(mod(my_col_in_minutes, 60)) "HH:MI" from dual
/

______________________________________________________
Rajendra Jamadagni              MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art!


-----Original Message-----
[mailto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 11:08 AM
To: Multiple recipients of list ORACLE-L


I was wondering if anyone might have tried this before, because I can't seem
to get it to work.  I'd like to be able to determine which unit of measure
to concatenate to a value by using a decode statement in the query.  I have
a column in the database that stores time in minutes, and I'd like to be
able to show the output in minutes if the value is less than 60, but in
hours (such as 3.27 hours) if the value is greater than 60.  So far I've
tried the following statement, but it seems to be blowing up on the first
comparison operator:

SELECT decode(in_value, to_char(to_number(in_value) <= to_number('60')),
to_char(in_value)||' minutes', to_char(to_number(in_value) >
to_number('60')), to_char(in_value/60, '9.99')||' hours')
  FROM dual
/

I'm selecting from dual just until I can get the query working at all.  Is
what I'm trying to do even possible?  Any help or ideas would be greatly
appreciated.  Thanks in advance.

_YEX_

*********************************************************************2

This e-mail message is confidential, intended only for the named recipient(s) above 
and may contain information that is privileged, attorney work product or exempt from 
disclosure under applicable law. If you have received this message in error, or are 
not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 
and delete this e-mail message from your computer, Thank you.

*********************************************************************2

Reply via email to