Oracle Database - Like SQL Condition

Card Puncher Data Processing

About

The like Sql condition in Oracle Database SQL

Syntax

like 'Pattern'

where the pattern can contain special pattern-matching characters:

  • An underscore (_) in the pattern matches exactly one character (as opposed to one byte in a multibyte character set) in the value.
  • A percent sign (%) in the pattern can match zero or more characters (as opposed to bytes in a multibyte character set) in the value. The pattern '%' cannot match a null.

You can include the actual characters % or _ in the pattern by using the ESCAPE clause, which identifies the escape character.

Example

SELECT 'true' FROM dual WHERE '1' LIKE '_' ESCAPE '\';

will return true because 1 is a character.

SELECT 'true' FROM dual WHERE '1' LIKE '\_' ESCAPE '\';

will return nothing because 1 is different from an underscore.

Documentation / Reference







Share this page:
Follow us:
Task Runner