The substr() function extracts a substring of a string. The syntax is: substr(str, start, [length]). Usage example: Extract the 4 characters starting from the 3rd character from 'Hello World': SELECT substr('Hello World', 3, 4) FROM dual; Result: 'llo'.
Usage of substr() function in Oracle
The substr() function is used to extract substrings from strings . The syntax is as follows:
<code>substr(str, start, [length])</code>
Where:
Usage example
<code>SELECT substr('Hello World', 3, 4) FROM dual;</code>
Output:
<code>llo </code>
Example description:
Other usage examples:
Extract the first character of the string:
<code>SELECT substr('Oracle', 1, 1) FROM dual;</code>
Extract the last few characters of the string:
<code>SELECT substr('Database', -3) FROM dual;</code>
Extract the substring of the specified length:
<code>SELECT substr('Programming', 1, 8) FROM dual;</code>
Note:
The above is the detailed content of Usage of substr function in oracle. For more information, please follow other related articles on the PHP Chinese website!