Reputation: 87
Lets say I have a table which storing HOURS and MINUTES in two different column. For example:
HOURS|MINUTES
------------------
1|11
2|22
3|33
How can I merge the hours and minutes in my table into current timestamp
My concept are as below
SELECT TRUNC(CURRENT TIMESTAMP) + HOURS + MINUTES FROM MYTABLE;
Upvotes: 0
Views: 114
Reputation: 87
After several hours of trying i find out that i need to further enhance my table design, instead of storing minute and hours in different column, is better that i store in in single column. The sample value can be '18:36:00'
then use the following query to convert it
(SELECT CAST(? AS TIMESTAMP) + HOUR(TIME(END_TIMESTAMP)) HOURS + MINUTE(TIME(END_TIMESTAMP)) MINUTES FROM MY_TABLE
Upvotes: 0
Reputation: 48207
try this one
select current timestamp + HOURS hour + MINUTES minute
from sysibm.sysdummy1
Upvotes: 1