In Oracle, the like statement is often used in conjunction with the where statement to retrieve the corresponding substring contained in a character field; this statement is mainly for character fields, and the syntax is "select * from table name where field name like corresponding value (substring)".
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
The syntax format of the like statement is:
select * from 表名 where 字段名 like 对应值(子串)
It is mainly for character fields, and its function is to Search the field column containing the corresponding substring.
We can use the like keyword in the where clause to achieve the effect of Oracle fuzzy query; in the where clause, we can use the Like keyword with wildcards for columns of datetime, char, and varchar field types. Fuzzy query,
The following are wildcard characters that can be used:
%: zero or more characters, there are three situations when using %
Field like ' Records where the %Keyword%' field contains "Keyword"
Field like Records where the 'Keyword%' field starts with "Keyword"
Records with fields like '% keyword' whose field ends with "keyword"
Example:
Single any Characters (underscores) are often used to limit the character length of expressions:
Example:
Characters within a certain range represent those listed in brackets One of the characters (similar to a regular expression). Specify a character, string, or range, requiring the matched object to be any one of them.
Example:
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of How to use like query statement in oracle. For more information, please follow other related articles on the PHP Chinese website!