Need to break down the CASE statement so each condition can be tested.
This nested statement currently has me lost.
select
CASE NVL(UPPER(load_cl_item.fd_type_code),'')
WHEN 'B' then 0
ELSE
case
when stage_cl_header.gst_ind = 'N' then round(load_cl_item.pd_amount*dim_tax.rate_conv_incl_to_excl, 2)
else load_cl_item.pd_amount
end
END,
load_cl_item.fd_type_code,
CASE NVL(UPPER(load_cl_item.fd_type_code),'')
WHEN 'B' then
case
when stage_cl_header.gst_ind = 'N' then round(load_cl_item.cl_amount*dim_tax.rate_conv_incl_to_excl, 2)
else load_cl_item.cl_amount
end
ELSE
case
when stage_cl_header.gst_ind = 'N' then round(load_cl_item.pd_amount*dim_tax.rate_conv_incl_to_excl, 2)
else load_cl_item.pd_amount
end
END,
from etc
l