2009年5月15日 星期五

Oracle substring

select a, substr(concat(trim(a),' '),-5,4) as substr from tablename;
A SUBSTR
12345 2345
2345 2345
22345 2345

select * from
tablename where substr(concat(trim(a),' '),-5,4) = '2345';
12345
2345
22345

select col, substr(trim(col),-4,4) from tablename;
12345,2345
22345,2345
2345,2345

沒有留言: