0"."/> 0".">

Home  >  Article  >  Database  >  How does Oracle determine whether it contains characters?

How does Oracle determine whether it contains characters?

WBOY
WBOYOriginal
2022-05-24 18:29:3315800browse

Method: 1. Use like with "%", the syntax is "where field like '% character %';"; 2. Use the contains function, the syntax is "contains (field, 'character');" ;3. Use the instr function, the syntax is "instr (field, 'character') > 0".

How does Oracle determine whether it contains characters?

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

How does oracle determine whether it contains characters

1. Use the wildcard character "%"

The syntax is similar:

select * from students where 字段 like ‘%字符%’

The example is as follows:

How does Oracle determine whether it contains characters?

2. Use the contains function

The syntax is:

select * from table1 where contains(字段, ‘字符’);

The example is as follows:

How does Oracle determine whether it contains characters?

There is a condition for using the contains predicate, that is, the column must be indexed. That is to say, if the Column1 column of the table1 table in the above statement is not indexed, an error will be reported, which has relatively large limitations.

3. Use the instr function

The syntax is:

select * from table1 where instr(字段,'字符') > 0 ;

The example is as follows:

How does Oracle determine whether it contains characters?

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How does Oracle determine whether it contains characters?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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