Adsense Ad

Tuesday 23 May 2017

Oracle: ORA-01424 Error Message

ORA-01424 Error Message

Learn the cause and how to resolve the ORA-01424 error message in Oracle.

Description

When you encounter an ORA-01424 error, the following error message will appear:
  • ORA-01424: missing or illegal character following the escape character

Cause

You tried to execute a LIKE condition using an escape character, but you the character following the escape character was not % or _.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

Try modifying your LIKE condition to use % or _ as the character that follows the escape character.
For example, if you tried to execute the following SQL statement:
SELECT *
FROM suppliers
WHERE supplier_name LIKE 'H%!' ESCAPE '!';
This example denotes the ! character as the escape character. However, since you do not have the % or _ character following the ! character, you would receive the following error message:
Oracle PLSQL
You could correct this error by inserting either the % or _ character after the ! character, as follows:
SELECT *
FROM suppliers
WHERE supplier_name LIKE 'H%!%' ESCAPE '!';
This example returns all suppliers whose name starts with H and ends in %. For example, it would return a value such as 'Hello%'.
OR
SELECT *
FROM suppliers
WHERE supplier_name LIKE 'H%!_' ESCAPE '!';
This example returns all suppliers whose name starts with H and ends in _. For example, it would return a value such as 'Hello_'.

No comments: