I have three fields that I need to concatenate as well as add dashes between them.
My concatenation looks like this:
FACT_CLAIM.Company_dim_id||'-'||FACT_CLAIM.line_number||'-'||FACT_CLAIM.sub_line_code as TEST3
This works fine until the last field, which can be null, the first two cannot be null. So I end up with data like this:
1. This is good: 589-2-R
2. This is bad: 589-1-
I don't want that dash after the 1 in my second scenario, this is what is desired 589-1.
I've tried CONCAT and a CASE statement and I can't get that last dash in my second scenario to go away.
CONCAT did this, no dash at all:
(CASE WHEN FACT_CLAIM.sub_line_code is NULL THEN FACT_CLAIM.Company_dim_id||'-'||FACT_CLAIM.line_number
Thanks for your help.