Demo Table And Records | |
Demo Data | 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; |
Wildcard Characters | |
Single Character | _ (underscore) |
SELECT * FROM wildcard WHERE test LIKE ’23_5′; | |
Multiple Characters | |
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 ‘\’; |
Tuesday, May 10, 2011
Oracle – Wildcards
Labels:
Database
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment