Hi Diter,
Finally we could create UDF for MINUTES for same.Please find the logic for sam which will be given in minutes
Let me know if i'm not wrong for same
REPLACE FUNCTION olap_Dev.TimeStamp_Diff_Minutes
(
Start_Ts TIMESTAMP(6)
,End_Ts TIMESTAMP(6)
)
RETURNS DECIMAL(18,6)
LANGUAGE SQL
CONTAINS SQL
DETERMINISTIC
SQL SECURITY DEFINER
COLLATION INVOKER
INLINE TYPE 1
RETURN
-- Get Days Difference in Minutes (* 24 hours per day * 60 minutes per hour)
(CAST(End_Ts AS DATE) - CAST(Start_Ts AS DATE)) * (24 * 60)
+
-- Get Hours Difference in Minutes ( * 60 minutes per hour)
(EXTRACT(HOUR FROM End_Ts) - EXTRACT(HOUR FROM Start_Ts)) * 60
+
-- Get Minutes Difference
(EXTRACT(MINUTE FROM End_Ts) - EXTRACT(MINUTE FROM Start_Ts));
;
SELECT olap_dev. TimeStamp_Diff_Minutes (TIMESTAMP '2011-01-17 22:00:00' ,TIMESTAMP '2011-01-17 23:00:00' )
Hi Diter,
Finally we could create UDF for MINUTES for same.Please find the logic for sam which will be given in minutes
Let me know if i'm not wrong for same
REPLACE FUNCTION olap_Dev.TimeStamp_Diff_Minutes
(
Start_Ts TIMESTAMP(6)
,End_Ts TIMESTAMP(6)
)
RETURNS DECIMAL(18,6)
LANGUAGE SQL
CONTAINS SQL
DETERMINISTIC
SQL SECURITY DEFINER
COLLATION INVOKER
INLINE TYPE 1
RETURN
-- Get Days Difference in Minutes (* 24 hours per day * 60 minutes per hour)
(CAST(End_Ts AS DATE) - CAST(Start_Ts AS DATE)) * (24 * 60)
+
-- Get Hours Difference in Minutes ( * 60 minutes per hour)
(EXTRACT(HOUR FROM End_Ts) - EXTRACT(HOUR FROM Start_Ts)) * 60
+
-- Get Minutes Difference
(EXTRACT(MINUTE FROM End_Ts) - EXTRACT(MINUTE FROM Start_Ts));
;
SELECT olap_dev. TimeStamp_Diff_Minutes (TIMESTAMP '2011-01-17 22:00:00' ,TIMESTAMP '2011-01-17 23:00:00' )