从右边10字符串获取字符串

时间:2012-09-11 05:47:55

标签: sql oracle

我的桌子是在oracle toad中。表包含列名称电话号码varchar2 datatype.it包含一组phonenumbers。有些数字超过10个字符。我想从右侧10个字符过滤该号码。

data's in the table
-------------------
phone number

9948184759
9948220955
994823298612
9948249815
99482599971234
9948277935
9948288258
99483015076789
9948335085
9948337552
9948338134

the above column values are phone numbers.but some numbers are more than 10 char length

that numbers are
----------------
 994823298612
 99482599971234
 99483015076789

 expected output for the above numbers
----------------------------------------
4823298612
2599971234
3015076789

Help me to do this? am new to oracle toad

2 个答案:

答案 0 :(得分:2)

简单:

select substr(phone_number, -10) from ...

答案 1 :(得分:0)

您可以通过使用Substr函数来实现此目的,例如

with T1 as 
( 
  select 99482599971234  n from dual union all
  select 99483015076789 n from dual union all
  select 994823298612 n from dual
) 

select substr(n, Length(n) - 9, 10) nn
  from t1


 Nn 
-------------------
4823298612 
2599971234 
3015076789