how to handle nulls in date coulmn in teradata -
this sql , want handle nulls date coulmn .
sql:
insert r_intraday_netrev ( report_time, snapshot_time, prodtype, qty, yestasp, m2_cumpct, m2_predictedunits, m2_rev, m3_cumpct, m3_predictedunits, m3_rev) select current_time report_time, **max(ss_sb1.snapshot_time),**------want handle nulls date coulmn 'ztotal', null, null, null, null, sum(round( ( (ss_sb1.qty / ss_p2.cumpct) * ss_sb2.asp ) , 0)), null, null, sum(round( ( (ss_sb1.qty / ss_p3.cumpct) * ss_sb2.asp) , 0)) dw_core.ss_topline_a_v ss_sb1 left outer join dw_core.ss_topline_rsst_b_v ss_sb2 on ss_sb1.prodtype = ss_sb2.prodtype left outer join dw_core.ss_predict_p2_v ss_p2 on (ss_sb1.prodtype = ss_p2.prodtype , td_day_of_week(ss_sb1.snapshot_time) = ss_p2.dayofweek , substr(to_char(ss_sb1.snapshot_time, 'hh24mi' ),1,3)||'0' = ss_p2.timeofday) left outer join dw_core.ss_predict_p3_v ss_p3 on (ss_sb1.prodtype = ss_p3.prodtype , (snapshot_time - interval '364' day) = ss_p3.lastyear_date , substr(to_char(snapshot_time, 'hh24mi' ),1,3)||'0' = ss_p3.lastyear_time) ;
can please me ...
you can use below check nulls in date:
coalesce((cast(datecolumn varchar2(10))),'')<>'' '
Comments
Post a Comment