Oracle Wildcard Characters
Version 12.1.0.1

General Information
Library Note Morgan's Library Page Footer
The Library is currently in the process of being upgraded from Oracle Database Version 11.2.0.3 to 12.1.0.1. Demos are being upgraded to reflect the new Container paradigm as well as EBR (Edition Based Redefinition) and may contain references to CDBs, PDBs, and other objects you may not be familiar with such as CDB_OBJECTS_AE: Welcome to 12c.
Purpose Make possible fuzzy search criteria in the SELECT statement's WHERE clause
 
Demo Table And Records
Demo Data conn uwclass/uwclass@pdbdev

CREATE TABLE wildcard (
test VARCHAR2(25));

INSERT INTO wildcard VALUES ('23%45');
INSERT INTO wildcard VALUES ('2345');
INSERT INTO wildcard VALUES ('2365');
INSERT INTO wildcard VALUES ('Daniel Morgan');
INSERT INTO wildcard VALUES ('Washington');
COMMIT;
SELECT *
FROM wildcard
WHERE test LIKE '%\%%' ESCAPE '\';
Wildcard Characters
Single Character _ (underscore)
SELECT *
FROM wildcard
WHERE test LIKE '23_5';
Multiple Characters % (percentage sign)
SELECT *
FROM wildcard
WHERE test LIKE '2%5';
Mixed Single And Multiple Characters SELECT *
FROM wildcard
WHERE test LIKE '_3%5';
Complex Statement SELECT *
FROM wildcard
WHERE test LIKE '%a%a %';
 
Querying Records Containing Wildcards
Find Records Containing Percentage Sign ESCAPE '<escape_character>'
SELECT *
FROM wildcard
WHERE test LIKE '%\%%' ESCAPE '\';

Related Topics
DELETE Statements
DML Statements
INSERT Statements
MERGE Statements
SELECT Statements
UPDATE Statements
WHERE Clause