Recipe 6.7. Extracting Initials from a Name

wuxidba發表於2010-12-09

1. translate把要改的挑出

2.replace掉

You want convert a full name into initials. Consider the following name:

	 Stewie Griffin


 

You would like to return:

	 S.G.
 
 
select replace ( translate (ename, 'abcdefghijklmnopqrstuvwxyz',rpad('a',26,'a.')),'a','' )   
from emp_1
where esal = '2000'


 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23895263/viewspace-681368/,如需轉載,請註明出處,否則將追究法律責任。

相關文章