在SQL中获取Escape字符

时间:2022-09-23 00:04:32
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

我想在Oracle中使用SQL来实现这一点。请帮忙

1 个解决方案

#1


1  

Use REPLACE:

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

#1


1  

Use REPLACE:

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