Good afternoon. Tell me how knowing the first and last character in a substring, pull out its value. I try this, but after for does not work.

SELECT SUBSTRING (STRG from (position ('№' IN STRG) +1) for (position ('от',STRG))) FROM NAME 
  • one
    What does it mean "does not work" gives an error or simply does not correctly count the characters. There generally in for the number of characters should be. And quantity is “position” from 'MINUS position' No. '” - Mike

1 answer 1

After FOR is not the end position, but the number of characters.

 SUBSTRING (STRG from (position ('№' IN STRG) +1) for (position ('от',STRG) - position ('№' IN STRG)))