Wildcard character underscore in DB2

 

 
 
 
 
 
 
 
 
 
 
Wildcard character _ in DB2
 
 
Wild card character _ (underscore) is used to substitute exactly one character in a DB2 query.
 
If you wish to fetch data from a DB2 table and you do not know what is the exact value in the column but you 
remember all the chars except one character somewhere in the value then you can use wild card character
_ (under score).
 
 
For example you are looking for employees whos first name is either JOLT or KOLT then you can use the following
query
; ; ; ;
 
SELECT * FROM EMP_TABLE WHERE FNAME LIKE '_OLT'
 
The above query will list down all the employees whose name starts with any char followed by "OLT"