SUBSTR function is used to extract substrings from strings. The syntax is SUBSTR(string, start, length). You need to specify the source string, starting position and length (optional), and the function extracts the substring of the specified length starting from the specified position. For example, SUBSTR('Hello World', 1, 5) returns "Hello" and SUBSTR('Hello World', 7) returns "World".
Usage of SUBSTR function in Oracle
What is SUBSTR function?
SUBSTR function is used to extract substrings from strings.
Syntax:
<code>SUBSTR(string, start, length)</code>
Where:
Usage:
When using the SUBSTR function, you need to specify the following parameters:
Examples:
The following are some example usages of the SUBSTR function in Oracle:
<code>-- 从 "Hello World" 中提取 "Hello" SELECT SUBSTR('Hello World', 1, 5) FROM dual; -- 从 "Hello World" 中提取 "World" SELECT SUBSTR('Hello World', 7) FROM dual; -- 从 "Hello World" 中提取从第 7 个字符开始的所有文本 SELECT SUBSTR('Hello World', 7, LENGTH('Hello World') - 6) FROM dual;</code>
Note:
The above is the detailed content of Usage of substr in oracle. For more information, please follow other related articles on the PHP Chinese website!