In order to match a Recipients column, I need to satisfay this conditions:
1.- If customer_cic is length 8, then add 4 spaces at the begging.
2.- If customer cic is length 12, leave it as it is.
I tried: Case(When(Length(customer_cic)==12,customer_cic, Else(' '+customer_cic))
But is giving me error.
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @god_prophet
The correct syntax is:
Case(When(Length(customer_cic)=12,customer_cic), Else(' '+customer_cic))
Hello @god_prophet
The correct syntax is:
Case(When(Length(customer_cic)=12,customer_cic), Else(' '+customer_cic))
hi @_Manoj_Kumar_ , I'm getting this error with that code:
10/17/2023 9:38:07 AM PGS-220000 PostgreSQL error: ERROR: operator does not exist: integer == integer LINE 1: ...cional = case when char_length(W0.sCustomer_cic) == 12 then... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. .
Then I tried:
Case(When(Length(toString(customer_cic))==12,customer_cic), Else(' '+customer_cic))
But gave me this error.
10/17/2023 9:32:51 AM PGS-220000 PostgreSQL error: ERROR: operator does not exist: integer == integer LINE 1: ...cional = case when char_length(W0.sCustomer_cic) == 12 then... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. .
I request your kindly help.
Views
Replies
Total Likes
Ok, this worked:
Case(When(Length(customer_cic)=12,customer_cic), Else(' '+customer_cic))
Thank you, Manoj.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies