Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

How to Use Round Function In Teradata - response (8) by Jessy Mahesh Kothapalli

$
0
0

 


Thanks for quick response (sorry :( above query-->oracle)

ORACLE QUERY:-
SELECT 
 ROW_WID,
 X_ATTRIB_27,
 SYSDATE,
 ROUND( ( W_ORDER_D.X_ATTRIB_27 - ( SYSDATE + ( 330 / 1440 ) ) ) * 24 ) AS COL1 , 
 ROUND ( W_ORDER_D.X_ATTRIB_27 - ( SYSDATE + ( 330 / 1440 ) ))  AS COL2
 FROM W_ORDER_D
 WHERE W_ORDER_D.ORDER_TYPE = 'Service Order'
 AND ROW_WID IN (11010,11011) ;

OUTPUT: -

ROW_WID X_ATTRIB_27,     SYSDATE,                          COL1,  COL2
11010	6/30/2004 10:55:20 AM	5/4/2013 3:31:30 PM	-77530	-3230
11011	6/30/2004 10:56:04 AM	5/4/2013 3:31:30 PM	-77530	-3230

TERADATA QUERY:-

select
ROW_WID ,
X_ATTRIB_27,
SYSDATE,
(OLAP_DEV.TimeStamp_Diff_Seconds(X_ATTRIB_27,SYSDATE) + 330 * 60)/3600 as col1,
OLAP_DEV.TimeStamp_Diff_Seconds(X_ATTRIB_27,SYSDATE)/3600/24  as col2 
FROM OLAP_DEV.VW_W_ORDER_D_BKP04
WHERE  ROW_WID IN (11010,11011)
AND ORDER_TYPE = 'Service Order' 
OUTPUT
11,011	06/30/2004 10:56:04.000000	05/04/2013 15:32:44.014000	-77519.111150	 -3230.192131
11,010	06/30/2004 10:55:20.000000	05/04/2013 15:32:44.014000	-77519.123372	 -3230.192640

As we achived in teradata by using TimeStamp_Diff_Seconds UDF function which you gave earlier.
 
I request you to write an UDF which will be given in days as if it is in oracle and should allow more than 9999 values (TD has limitatiion that  it will not allow more than 9999)
As you said I’ll do CAST for ROUND function  ( NO problem for this)
Please help me out from this plight.
 


Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>