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:
substr(str, start, [length])
Where:
Usage example
SELECT substr('Hello World', 3, 4) FROM dual;
Output:
llo
Example description:
Other usage examples:
Extract the first character of the string:
SELECT substr('Oracle', 1, 1) FROM dual;
Extract the last few characters of the string:
SELECT substr('Database', -3) FROM dual;
Extract the substring of the specified length:
SELECT substr('Programming', 1, 8) FROM dual;
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!