Saturday, 23 April 2016

How can I manage special characters (for example: " _ ' % ) when I execute an INSERT query ?


The characters "%" and "_" have special meaning in SQL LIKE clauses (to match zero or more characters, or exactly one character, respectively).

In order to interpret them literally, they can be preceded with a special escape character in strings, e.g. "\".
In order to specify the escape character used to quote these characters, include the following syntax on the end of the query:

{escape 'escape-character'}

For example, the query
SELECT NAME FROM EMP WHERE ID LIKE '\_%' {escape '\'}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.