Oracle's method of intercepting the first few digits of a string
Oracle uses the substr function to advance the first few digits of a certain data .
For example, the data in the test table is as follows:
Now to extract the first two digits in the dept field, you can use the following statement:
select id,name,substr(dept,1,2) from test;
Result:
substr function introduction:
Syntax:
substr(string,start,length)
Parameters:
string - the specified one to be intercepted The string
start - required, specifies where to start in the string
Positive number - starts at the specified position in the string
Negative number - starts at the end of the string Starts at the specified position
0 - Starts at the first character in the string
length - Optional, specifies the length of the string to be intercepted, and returns the character expression by default All characters before the end of the value.
The above is the detailed content of Oracle method to intercept the first digits of a string. For more information, please follow other related articles on the PHP Chinese website!