How can I replace single-quote (') with double-quote (") in sql query - oracle 10g?
5 Answers
This should work:
UPDATE myTable
SET field = replace(your_string,Chr(39),Chr(39)||Chr(39));
1 Comment
Johan
I believe your answer is replacing a
' with two duplicate characters (''). While it might looks the same, it's actually not the same character as the author asked about, which is " (character 34).Ten bucks says this thing is wide-open to SQL injection and the correct answer is to use parameterization.
2 Comments
Cody Gray
This answer would have been much more helpful if you'd provided an example of parameterization. How would you use it to solve this problem?
Mark Sowul
We know nothing about the environment from which this is being called, nor the query, so there's no general example I can give that will be in any way relevant. It's probably something called from client code and there are any number of ways to parameterize that.