I am trying to do this that strips "[‘" or "’]" in the string.
For Example, if we have [‘Customer Name’] it should be "Customer Name"
select regexp_replace("['Customers NY']","\\['|\\']","") as customername;
I am getting this error–
SQL compilation error: error line 1 at position 22 invalid identifier "[‘Customers NY’]"
>Solution :
It’s a typo..
ALL string in SQL are single quotes only.. you double quotes are for named objects like columns/tables.
Then you will have to escape the quotes in the quotes
select regexp_replace('[\'Customers NY\']','\\[\'|\'\\]','') as customername;
gives:
| CUSTOMERNAME |
|---|
| Customers NY |