Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have the following sql load statement and I am receiving an error. I'm sure it's something simple and would really appreciate any advice.
The statement works if I comment out from 'case' to 'end'.
Thanks,
Daniel
select ph.create_dt,ph.hdr_num,ph.pay_dt_calendar_cd,ph.pay_dt_days1,ph.pay_dt_days2,ph.pay_dt_days_type_ind,ph.pay_dt_event1_ind,ph.pay_dt_event2_ind
from tempest_tier1.v_BO_PHYSICAL_HDR ph
where create_dt > '2015/10/10'
case
when ph.pay_dt_days_type_ind = "B"
then "Business Days"
end
Hi Clever Anjos
At the moment ph.pay_dt_days_type_ind returns B or C.
I would like it to return Business Days (instead of B) and Calendar Days (instead of C).
I hope the above makes sense.
Balraj - unfortunately that code returns an error as well.
select ph.create_dt
,ph.hdr_num
,ph.pay_dt_calendar_cd
,ph.pay_dt_days1
,ph.pay_dt_days2
,case when ph.pay_dt_days_type_ind = "B" then "Business Days" end as ph.pay_dt_days_type_ind
,ph.pay_dt_event1_ind
,ph.pay_dt_event2_ind
from tempest_tier1.v_BO_PHYSICAL_HDR ph
where create_dt > '2015/10/10'
...and add this between case and end (for example before the first 'when')
when ph.pay_dt_days_type_ind = 'C' then 'Calendar Days'
As Clever already indicated, use single quotes to specify string values in SQL.
Best,
Peter