創建測試表及數據
1
2
3
4
5
6
7
8
9
|
create
table
test
(
name
varchar2(10));
insert
into
test
values
(
'2-15'
);
insert
into
test
values
(
'2-33'
);
insert
into
test
values
(
'2-3'
);
insert
into
test
values
(
'12-8'
);
insert
into
test
values
(
'12-22'
);
insert
into
test
values
(
'12-3'
);
|
執行
1
|
select
name
,substr(
name
,1,instr(
name
,
'-'
)-1) 前,substr(
name
,instr(
name
,
'-'
)+1,length(
name
)-instr(
name
,
'-'
)) 后
from
test
|