语法:
substr( string, start_position, [ length ] )
取子字符串,从start_position开始,取length个,length为可选,如果length为空则返回start_position后的所有字符。
实例:
substr('This is a test', 6, 2) would return 'is'
substr('This is a test', 6) would return 'is a test'
substr('TechOnTheNet', 1, 4) would return 'Tech'
substr('TechOnTheNet', -3, 3) would return 'Net'
substr('TechOnTheNet', -6, 3) would return 'The'
substr('TechOnTheNet', -8, 2) would return 'On'
select substr('TechOnTheNet', -3, 2) from dual
start_position为负数时,表示从字符串尾巴倒着数
(thismonth)转贴:http://hi.baidu.com/stanver/blog/item/710fbd1bae7e58118618bf31.html