In Oracle, you can use the substr function to intercept the last few digits of a string. This function is also called the character interception function. It is used to intercept the specified characters in the string. The syntax is "substr(need to intercept String, - the number of digits that need to be intercepted, the number of digits that need to be intercepted)".
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
How does oracle intercept the last few digits of a string
Introduction to the use of substr function format (commonly known as: character interception function):
Format 1: substr(string string, int a, int b);
1. string The string to be intercepted
2. a intercepts the starting position of the string (note: when a is equal to 0 or 1, interception starts from the first position)
3. b The string to be intercepted The length of
Format 2: substr(string string, int a);
1. string The string to be intercepted
2. a can be understood as intercepting all subsequent strings starting from the a-th character.
The example is as follows:
select substr('HelloWorld',-4,4) value from dual;
Return result: orld
Take 4 characters starting from the 4th digit from the bottom.
Also:
Recommended tutorial: "Oracle Tutorial"
The above is the detailed content of How to intercept the last few digits of a string in oracle. For more information, please follow other related articles on the PHP Chinese website!