Home > database >  Interception of string for help great god ~!
Interception of string for help great god ~!

Time:10-12

I want to capture a string after a few digits are not fixed, however, oracle SQL need how to write,,,
Such as 16 _4253116201_3600 * 1 * 4 after the string may take six of seven after eight this SQL how to write

CodePudding user response:

After the substr function, as to a few if not fixed, you can write a function to be good, let digits as a parameter to

CodePudding user response:

- use substr, first get the length of the string, use length minus the length of the need to intercept plus 1 get from which a interception, the final parameter is the length of the intercept
SELECT SUBSTR (' 16 _4253116201_3600 * 1 * 4 ',
LENGTH (' 16 _4253116201_3600 * 1 * 4 ') - 6 + 1,
6)
The FROM DUAL;

CodePudding user response:

How much we want to capture the value, to 6, 7, 8;
More than this time to ask questions, check the document,
Select substr (' 16 _4253116201_3600 * 1 * 4, and 6) from dual;
  • Related