Home > database >  Oracle9i split: string of letters and Numbers
Oracle9i split: string of letters and Numbers

Time:10-05

SELECT 'A1BC1D FROM DUAL;
Objective
A1
B
C1
D
Used to query the other table
Select * from a where clause a.n ame='A1';
Select * from a where clause a.n ame='B';
Select * from a where clause a.n ame='C1';
Select * from a where clause a.n ame='D';

CodePudding user response:

9 I seemingly don't support regular,
What is law, such as how to extract A12BC1D

CodePudding user response:


SELECT the replace (MAX (SYS_CONNECT_BY_PATH (val, ' ')), ' ', ')
The FROM (select val,
Flag,
ROW_NUMBER () OVER (PARTITION BY flag ORDER BY flag) RN2
The from (select val,
(case
When the ASCII (val) & lt; 57 then=
0
The else
1
End) + rn flag,
Rn
The from (select substr (' CA1BC1D 'rownum, 1) val, rownum rn
The from dual
Connect by rownum & lt;=length (' CA1BC1D))))
START WITH RN2=1
CONNECT BY the PRIOR flag=flag
AND the PRIOR RN2=RN2-1
GROUP BY flag
The order by flag
  • Related