Use the INSTR function in Oracle to check whether a string contains specific characters. Syntax: INSTR(string, substring, [start_position], [occurrence]). It returns the index position of the first occurrence of the substring in the string, or 0 if no match is found.
Function containing specific characters in Oracle: INSTR
In Oracle, you can use INSTR
Function to check whether a string contains another string.
Syntax
<code>INSTR(string, substring, [start_position], [occurrence])</code>
Parameters
Usage
INSTR
The function returns the index position of the first occurrence of the substring in the string. Returns 0 if no match is found.
For example, the following query finds the first occurrence of the character 'o'
in the string 'Hello World'
:
<code>SELECT INSTR('Hello World', 'o') FROM dual;</code>
Output:
<code>4</code>
This means that the character 'o'
is at index 4 in the string 'Hello World'
.
Note
start_position
is greater than the length of the string, the INSTR
function will return 0. INSTR
function returns 0 if occurrence
is greater than the number of times the substring occurs in the string. The above is the detailed content of What function is used to define a certain character in Oracle?. For more information, please follow other related articles on the PHP Chinese website!