Re: Problem with Times from Sql*Plus
Date: Sun, 18 Apr 1993 07:15:58 GMT
Message-ID: <1993Apr18.071558.21364_at_oracle.us.oracle.com>
mcgrathm_at_vax1.tcd.ie writes:
|> Hi Folks,
|>
|> I would like to use a sql script to add a time and a duration
|> (in minutes ) to produce a finish time :-
|>
|>
|> select start_time,duration,start_time + duration
|> from table
|> where condition etc.
|>
|>
|> It works ok for 11.00 + .50 = 11.50, but examples such as 11.00 + 60 or
|> 11.00 + 65 = 11.65 are not so good.
|>
|> I was hoping some type of to_date formatting might save programming
|> but I was't able to hit on the right combination.
|>
|> I would be greatful for any suggestions from people who might
|> have run into this problem.
|>
|> Thanks,
|>
|> Mike.
You might want to note that Oracle does date arithmetic treating days as whole numbers. For example,
SQL> select to_char(trunc(sysdate)+3/24, 'HH24:MI:SS') from dual;
returns
03:00:00 (or 3AM).
So if duration were expressed in number of minutes, it would be start_date + (duration/(24*60))
Hope this is what you were looking for.
Roderick Manalac
Oracle Corporation
[DISCLAIMER: Too late at night to think of something original]
Received on Sun Apr 18 1993 - 09:15:58 CEST