Oracle Wildcard Characters
Version 19.2.0.1

General Information
Library Note Morgan's Library Page Header
For how many years have you been working with physical servers that are starving your database of the memory necessary to deploy important new performance features such as the Result Cache, Memoptimize Pool, In-Memory Aggregation, In-Memory Column Store, and Full Database Caching? Too long? Contact me to learn how to improve all queries ... not just some queries.
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 '\';
Find values beginning with an underscore character ESCAPE '<escape_character>'
SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc DESCRIPTION
FROM x$ksppi x, x$ksppcv y
WHERE x.inst_id = userenv('Instance')
AND y.inst_id = userenv('Instance')
AND x.indx = y.indx
AND x.ksppinm like '\_b%' ESCAPE '\'
ORDER BY 1;

Related Topics
Built-in Functions
Built-in Packages
DELETE Statements
DML Statements
INSERT Statements
MERGE Statements
SELECT Statements
UPDATE Statements
WHERE Clause
What's New In 18cR3
What's New In 19cR2