Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace single-quote with double-quote in sql query - oracle 10g?

Tags:

sql

oracle

How can I replace single-quote (') with double-quote (") in sql query - oracle 10g?

like image 528
Gold Avatar asked Oct 19 '09 15:10

Gold


2 Answers

This should work:

UPDATE myTable
SET myField = REPLACE(myField, '''', '"');
like image 103
Kip Avatar answered Oct 26 '22 00:10

Kip


You can use Ansi-codes as well, to make it more crystal what is happening:

SELECT someString
      ,replace(someString, Chr(39), Chr(34)) as replacedString
FROM   (SELECT ' abc ' || Chr(39) || ' def ' as someString
        FROM   Dual)

39 is a single quote, 34 a double quote

like image 25
Robert Giesecke Avatar answered Oct 26 '22 00:10

Robert Giesecke