date + interval: How ??
Posted in 2000
Topics: General Discussion
Help Please !!
I created a table test_tb and inserted one row of data as shown below.
How do I calculate the end_time ??????????
(If I can get the select working below than I will change it into an update
statement .)
After speeding about 4 hours of RTFM ( all 3 sql manuals ) , searching the
faq of
of this group (IIUG ) and trying many many many different syntax
combinations, I am ready to pull my
hair out :-(
_________________________________________________________
create table test_tb
(
start_time datetime year to second,
duration datetime hour to second,
end_time datetime year to second
);_________________________________________________________
select * from test_tb
start_time 2000-07-17 21:15:00
duration 01:35:00
end_time
1 row(s) retrieved.
_________________________________________________________
This bellow does not work:
_________________________________________________________
select
datetime ( start_time ) year to second + interval(duration) hour to second
from test_tmp;
Database selected.
201: A syntax error has occurred.
Error in line 2
Near character position 39
Database closed.
( It does not like the plus )
How should I do this start_time + duration calculation ?????????
Thanks,
Isaac
______________________________
Isaac Loven.
For duration you should use interval hour to second instead of datetime hour
to second.
Informix is capable of adding datetime and interval values, resulting in a
datetime, as well as subtracting datetime values, resulting in an interval
value.
Frido
"Loven, Isaac" <Isaac.Loven@team.telstra.com> wrote in message
news:8ndm67$dbj$1@news.xmission.com...
>
> Help Please !!
>
> I created a table test_tb and inserted one row of data as shown below.
>
> How do I calculate the end_time ??????????
>
> (If I can get the select working below than I will change it into an
update
> statement .)
>
> After speeding about 4 hours of RTFM ( all 3 sql manuals ) , searching the
> faq of
> of this group (IIUG ) and trying many many many different syntax
> combinations, I am ready to pull my
> hair out :-(
>
> _________________________________________________________
> create table test_tb
> (
> start_time datetime year to second,
> duration datetime hour to second,
> end_time datetime year to second
> );> _________________________________________________________
>
> select * from test_tb>
> start_time 2000-07-17 21:15:00
> duration 01:35:00
> end_time
>
> 1 row(s) retrieved.
> _________________________________________________________
> This bellow does not work:
> _________________________________________________________
> select
> datetime ( start_time ) year to second + interval(duration) hour to
second
>
> from test_tmp;
>
> Database selected.
>
> 201: A syntax error has occurred.
> Error in line 2
> Near character position 39>
> Database closed.
> ( It does not like the plus )
>
> How should I do this start_time + duration calculation ?????????
>
> Thanks,
> Isaac
> ______________________________
> Isaac Loven.