在SQL中获取Escape字符

时间:2016-01-20 07:45:22

标签: sql oracle escaping delimiter

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

输出:

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

期望的输出:

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

我想在Oracle中使用SQL实现此目的。请帮忙

1 个答案:

答案 0 :(得分:1)

使用REPLACE

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