我正在尝试在php中创建一个排序系统,如果我输入如下所示的字符串
Zahirul Islam 25
Saidul Rahman 10
Karim Uddin khan 17
输出将会像
Saidul Rahman 10
Karim Uddin khan 17
Zahirul Islam 25
答案 0 :(得分:0)
SQL> with test (col) as
2 (select 'MERGE|WorkRelationship|||2020/12/31|RESIGNATION|Y||XYZ Limited|12345A' from dual
3 union all
4 select 'Little|Foot' from dual
5 )
6 select rtrim(regexp_substr(col, '[^|]*\|?', 1, column_value), '|') val
7 from test cross join
8 table(cast(multiset(select level from dual
9 connect by level <= regexp_count(col, '\|') + 1
10 ) as sys.odcinumberlist))
11 order by col, column_value;
VAL
------------------------------
Little
Foot
MERGE
WorkRelationship
2020/12/31
RESIGNATION
Y
XYZ Limited
12345A
12 rows selected.
SQL>