Re: Intervals and Units help
Posted in 1996
I think the only way to do this within ISQL is to do this:
-----------------------------------------------------------------
-- You need a table that you can do math with for the last select
create temp table foo(
hh char(2),
mm char(2),
ss char(2)
) with no log;
insert into foo
select
extend( extend( (extend( today, year to second) + your_interval_col ),
hour to second), hour to hour),
extend( extend( (extend( today, year to second) + your_interval_col ),
hour to second), minute to minute),
extend( extend( (extend( today, year to second) + your_interval_col ),
hour to second), second to second)
from your_interval_table;
select hh, mm, ss, trunc(hh*60*60+mm*60+ss) total_seconds from foo
-----------------------------------------------------------------------------
total_seconds will contain the value you need.
Scott Rubin
At 12:12 PM 4/3/96 -0500, you wrote:
>I have a column in a 7.12 Online database defined as INTERVAL HOUR TO SECOND.
>I would like to display the values in this column as seconds - not just the
>seconds component, but as the total number in seconds. Is it possible to do
>this within an embedded SQL statement? I need to perform this operation within
>a statement so that I can include the values in an ad hoc reporting tool
report.
>
>Thanks...Mark
>--
>+-------------------------------------------------------------------------+
>| Mark Christmas |
>| CrossKeys Systems Corp mchristmas@crosskeys.com |
>| 362 Terry Fox Dr |
>| Kanata, ON Phone (613) 591-1600 |
>| Canada K2K 2P5 Fax (613) 599-3626 |
>+-------------------------------------------------------------------------+
>
>