Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Need to understand a logic

Received Response
11
Views
2
Comments
User_B7ZTH
User_B7ZTH Rank 5 - Community Champion

Hello Experts,

Can you please let me know what does this where condition query means:-

case  when not concat(DIM_USERS.USER_ID, '.') is null then 'Restricted' end  = 'Restricted' and

case  when not concat(DIM_CUSTOMERS.CUSTOMER_ID, '.') is null then 'Limited' end  = 'Limited' and

case  when not concat(DWF_EVENTS_SUM.USER_ID, '.') is null then 'Restricted' end  = 'Restricted' and

case  when not concat(DWF_EVENTS_SUM.CUSTOMER_ID, '.') is null then 'Limited' end  = 'Limited' and

case  when not cast(DIM_USERS.USER_ID as  CHARACTER ( 24 ) ) is null then '' end  not like '%Test%' and

case  when not cast(DWF_EVENTS_SUM.USER_ID as  CHARACTER ( 24 ) ) is null then '' end  not like '%Test%' )

I am not able to understand a the logic.

However DIM_USERS has two lts with Restricted and Limited

similar case with Dim_customers has two LTS with Restricted and Limited.

Now need to understand a how this where condition work.

Thanks & Regards,

Abhi

Answers

  • Robert Angel
    Robert Angel Rank 8 - Analytics Strategist

    Yuk!

    I don't see the point of the concat as concat joins two fields and the '.' seems largely pointless and only serves to unnecessarily complicate (sic) the code without adding value.

    I would read it as; -

    (IF Dim_Users.User_id is not null then 'Restricted'

    ELSE IF DIM_CUSTOMERS.CUSTOMER_ID is not null then 'Limited'

    ELSE IF DWF_EVENTS_SUM.USER_ID is not null then 'Restricted'

    ELSE IF DWF_EVENTS_SUM.CUSTOMER_ID is not null then 'Limited'

    ELSE IF DIM_USERS.USER_ID is not null then ''

    END IF)   NOT LIKE '%Test%'      not like '%Test%'      --!!! this will always be true there is no Test in the above results of the IFs!!!!!

    AND

    (IF DWF_EVENTS_SUM.USER_ID is not null then '' end) NOT LIKE '%Test%')  --!!! this will always be true there is no Test in the above results of the IFs!!!!!

    In short I cannot envisage a scenario where the above code would do anything useful... it is a lot of sound and fury signifying nothing.... you might as well AND (1=1) it would achieve as much as the above.

  • User_B7ZTH
    User_B7ZTH Rank 5 - Community Champion

    Thanks Robert, I was on leave for few days just came back back.