Oracle函数substr()

Oracle函数substr() substr()在oracle数据库中substr()函数用于从字符串中提取子字符串语法substr(string,start_position,[length])string要从中提取子串的原始字符串start_position提取的起始位置。默认从1开始如果start_position为正数从左向右数1表示第一个字符如果start_position为负数从右向左数-1表示最后一个字符如果start_position为0会输出完整string字符串length(可选)要提取的子串长度省略表示从start_position到字符串末尾的所有字符样例code1select substr(Hello World,1,3) from dual;output1code2select substr(Hello World,-2) from dual;output2code3select substr(Hello World,0) from dual;output3