How to insert simple string with ' char into oracle database
18,357
Solution 1
To escape reserved chars like '
, you'll probably want to double the apostrophe character. See http://www.orafaq.com/faq/how_does_one_escape_special_characters_when_writing_sql_queries
Solution 2
To be complete, you can also use the q function : q'[Mc'Donalds]'
See also this blog entry: http://www.talkapex.com/2009/03/q-function-escape-single-quotes.html
Author by
gabrjan
Updated on June 04, 2022Comments
-
gabrjan almost 2 years
So my problem is that i need to insert company names into some database. It works fine but when i try to insert, for example Mc'Donalds it doesnt work because it finds end before the real end. So when i try that:
Inert into mydatabase (name, adress) values ('Mc'Donalds', 'somewhere')
It crashes. Is there some char like \ to ignore it? Thank u!