Oracle provides two string interception functions: substr(): intercepts characters of the specified length starting from the specified position. substring(): intercept the remaining characters from the specified position, or intercept the characters of the specified length from the specified position.
String interception function in Oracle
In order to facilitate the interception of strings, Oracle provides two functions, substr() and substring. (), their usage is similar.
substr(string, start, length)
Truncate length characters starting from the start character from the string string.
Example:
<code class="sql">SELECT substr('Hello World', 6, 5) FROM dual; -- 输出:World</code>
substring(string, start [, length])
Intercept from string string A string starting with the start character. If length is not specified, truncates to the end of the string.
Example:
<code class="sql">SELECT substring('Hello World', 6) FROM dual; -- 输出:World SELECT substring('Hello World', 2, 3) FROM dual; -- 输出:ell</code>
Note:
The above is the detailed content of Function to intercept string in oracle. For more information, please follow other related articles on the PHP Chinese website!