Rlad
Rlad

Reputation: 31

Get a Escape character in SQL

Select '"'||Address||'","'||zipcode||'"' from Address_table;

output:

"123 Main St Ave Apt 100","98765"   -- Good Data            
"312 Marco St Some Ave "Apt 3214"","76543" -- Bad Data

Desired Output:

"123 street Main Ave Apt 100","98765"    
"312 Marco St,Some Ave \"Apt 3214\"","76543"

I want to achieve this using SQL in Oracle. Please help

Upvotes: 1

Views: 40

Answers (1)

Jiri Tousek
Jiri Tousek

Reputation: 12440

Use REPLACE:

Select '"'||REPLACE(Address, '"', '\"')||'","'||zipcode||'"' from Address_table;

Upvotes: 1

Related Questions