1.获取子串的 substr(string, start[, count]):
start指定开始位置;count表示提取的长度,如果没有指定,则表示提取到字符串的结尾。
SQL> select substr(\'Hello, world!\', 8, 5) from dual; SUBSTR(\'HELLO,WORLD!\',8,5) -------------------------- world SQL> select substr(\'Hello, world!\', 8) from dual; SUBSTR(\'HELLO,WORLD!\',8) ------------------------ world! SQL>
位置从 1 开始:
SQL> select substr(\'Hello, world!\', 1, 5) from dual; SUBSTR(\'HELLO,WORLD!\',1,5) -------------------------- Hello SQL>