|
|
发表于 2012/11/13 14:12:44
|
显示全部楼层
因为有事情没有测试其他例子,试试下面这个吧,可能有点长,可以改写一个get function应该能简化点。
可能还有其他简单的办法,目前我只能想到这个。
SELECT DECODE(SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',45,1),' ',SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',1,44)||CHR(10)||SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',46),SUBSTR(SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',1,44),1,INSTR(SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',1,44),' ',1,LENGTH(SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',1,44)) - LENGTH(REPLACE(SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',1,44),' ',''))))||CHR(10)||SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',INSTR(SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',1,44),' ',1,LENGTH(SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',1,44)) - LENGTH(REPLACE(SUBSTR('RM 3801, CABLE TV TOWER9 HOI SHING WAN NTHONG KONG',1,44),' ','')))+1))
FROM DUAL |
|