Home > Database > Oracle > body text

What is Oracle fuzzy query statement?

WBOY
Release: 2022-01-25 10:18:50
Original
13907 people have browsed it

In Oracle, you can use the like keyword in the where clause to achieve fuzzy query effects. The character matching operation can use wildcards "%" and "_", and the syntax is "SELECT * FROM user WHERE column name LIKE 'fuzzy query field'".

What is Oracle fuzzy query statement?

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

What is oracle fuzzy query statement

In this era where the amount of information is increasing dramatically, fuzzy query is essential to help users retrieve the desired data from massive amounts of data. So how is fuzzy query implemented in Oracle?

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 the wildcard characters that can be used:

The most commonly used and simplest way is to use "%" and "_".

Wildcard characters "%" and "_" can be used for character matching operations:

%: represents any number of characters, including zero;

_: represents any character;

The escape keyword implements like matching of special characters and the escape of & characters.

For example:

SQL> select * from dept; 
DEPTNO DNAME          LOC  
------ -------------- -------------  
    10 ACCOUNTING     NEW YORK  
    20 RESEARCH       DALLAS  
    30 SALES          CHICAGO  
    40 OPERATIONS     BOSTON
Copy after login

"%" and "_" Demonstration:

SQL> select * from dept where DNAME like '_A%'; 
DEPTNO DNAME          LOC  
------ -------------- -------------  
    30 SALES          CHICAGO
Copy after login

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of What is Oracle fuzzy query statement?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template