LIKE escape character sequence for wildcards
- Last Updated: August 10, 2021
- 1 minute read
- DataDirect Connectors
- JDBC
- Aha! 6.0
- Amazon Redshift 6.0
- Apache Cassandra 6.0
- Apache Hive 6.0
- Apache Spark SQL 6.0
- Atlassian Jira 6.0
- Autonomous REST Connector 6.0
- Cloudera Impala 5.1
- + 24
You can specify the character to be used to escape wildcard characters (% and _, for example) in LIKE clauses. The escape sequence for escape characters is:
{escape 'escape-character'}
where:
- escape-character
- is the character used to escape the wildcard character.
For example. the following SQL statement specifies that an asterisk (*) be used as the escape character in the LIKE clause for the wildcard character %:
SELECT col1 FROM table1 WHERE col1 LIKE '*%%' {escape
'*'}
Note: The right-hand side of a
LIKE expression
must evaluate to a string or binary.