Hi BO-Gurus ,
I have a situation in my hand and need your help . We are at present moving three very important universe from SQL server to DB2. While most of the objects are tested fine .There is one measure which is supposed to calculate a percentage is failing in DB2 while it was successful in SQL server .
The SQL server function contains isnull() function which we have replaced by COALESCE() function . While SQL server was able to calculate the % Db2 is simply producing 0%.
following are the SQL definitions of the measure in SQL server and in DB2 :
@Aggregate_Aware(
case when isnull(sum( case when (DM_JOX_AGGR_YR_TBL.CARRIER_ID = 554)
then (DM_JOX_AGGR_YR_TBL.TEU) else 0 end ),0) = 0 then 0 else
(isnull(sum( case when (DM_JOX_AGGR_YR_TBL.CARRIER_ID = 554)
then (DM_JOX_AGGR_YR_TBL.TEU) else 0 end ),0) / sum(DM_JOX_AGGR_YR_TBL.TEU) ) end,
case when isnull(sum( case when (DM_JOX_AGGR_YR_MTH_TBL.CARRIER_ID = 554)
then (DM_JOX_AGGR_YR_MTH_TBL.TEU) else 0 end ),0) = 0 then 0 else
(isnull(sum( case when (DM_JOX_AGGR_YR_MTH_TBL.CARRIER_ID = 554)
then (DM_JOX_AGGR_YR_MTH_TBL.TEU) else 0 end ),0) / sum(DM_JOX_AGGR_YR_MTH_TBL.TEU) ) end,
case when isnull(sum( case when (DW_JOX_ALL_DATA_TBL.CARRIER_ID = 554)
then (DW_JOX_ALL_DATA_TBL.TEU) else 0 end ),0) = 0 then 0 else
(isnull(sum( case when (DW_JOX_ALL_DATA_TBL.CARRIER_ID = 554)
then (DW_JOX_ALL_DATA_TBL.TEU) else 0 end ),0) / sum(DW_JOX_ALL_DATA_TBL.TEU) ) end)
@Aggregate_Aware(
case when COALESCE(sum( case when (DM_JOX_AGGR_YR_TBL.CARRIER_ID =554)
then (DM_JOX_AGGR_YR_TBL.TEU) else 0 end ),0) = 0 then 0 else
(COALESCE(sum( case when (DM_JOX_AGGR_YR_TBL.CARRIER_ID =554)
then (DM_JOX_AGGR_YR_TBL.TEU) else 0 end ),0) / sum(DM_JOX_AGGR_YR_TBL.TEU) ) end,
case when COALESCE(sum( case when (DM_JOX_AGGR_YR_MTH_TBL.CARRIER_ID =554)
then (DM_JOX_AGGR_YR_MTH_TBL.TEU) else 0 end ),0) = 0 then 0 else
(COALESCE(sum( case when (DM_JOX_AGGR_YR_MTH_TBL.CARRIER_ID =554)
then (DM_JOX_AGGR_YR_MTH_TBL.TEU) else 0 end ),0) / sum(DM_JOX_AGGR_YR_MTH_TBL.TEU) ) end,
case when COALESCE(sum( case when (DW_JOX_ALL_DATA_TBL.CARRIER_ID =554)
then (DW_JOX_ALL_DATA_TBL.TEU) else 0 end ),0) = 0 then 0 else
(COALESCE(sum( case when (DW_JOX_ALL_DATA_TBL.CARRIER_ID =554)
then (DW_JOX_ALL_DATA_TBL.TEU) else 0 end ),0) / sum(DW_JOX_ALL_DATA_TBL.TEU) ) end)
A quick response will be highly appreciated as I’m in a hurry .to me it’s quite baffling why it’s not working .
Thanks in advance.
souravroy3 (BOB member since 2008-03-26)