I want to surround the selected column entries with double quotes whenever there is a special character say ‘ | ‘ in the column value .
select case when (p.email_address_text like '%|%') then 'true' -- where i want to surround the entry with double quotes else p.email end as email from dev_databse..tmp_new_student p where p.email_address_text like '%abc@abc.com%';
In the above query in the true condition I want to surround email by double quotes whenever email contains | . For ex if email is a|bc@gmail.com , I want it to be “a|bc@gmail.com”. Is it possible to do that ?
Advertisement
Answer
Apparently Netezza does have a concat operator . we can use. || to concat two string . Was able to achieve the desired out put with this