Function that contains a certain character in Oracle
In Oracle, you can use the INSTR
function to determine whether a string contains a certain character.
Syntax
<code>INSTR(string, search_string, start_position, occurrence)</code>
Parameters
string
: The string to search for. search_string
: The character or substring to be found. start_position
(optional): From which position in the string to start searching (counting from 1). occurrence
(optional): The number of occurrences to find (counting from 1). Return value
If search_string
is found, return its first occurrence in string
index position. If not found, returns 0.
Example
Find whether the character "r" exists in the string "Oracle":
<code>SELECT INSTR('Oracle', 'r');</code>
Result:
<code>3</code>
This Indicates that the character "r" is at position 3 (counting from 1) in the string "Oracle".
Find the third occurrence of the character "d" in the string "Database":
<code>SELECT INSTR('Database', 'd', 1, 3);</code>
Result:
<code>7</code>
This means that the character "d" appears in the string "Database" The third occurrence of " is in position 7 (counting from 1).
Note
start_position
parameter can only be used when the second parameter is a substring. occurrence
Parameters can only be used when the first parameter is a string. start_position
or occurrence
is negative or zero, treat it as 1. The above is the detailed content of What function is used to represent a certain character in Oracle?. For more information, please follow other related articles on the PHP Chinese website!