17,377
社区成员
发帖
与我相关
我的任务
分享
-- 试试正则表达式
SQL>
SQL> create table test(path varchar(52));
Table created
SQL> begin
2 insert into test values('192.168.10.1(echo),192.168.1.21');
3 insert into test values('192.168.10.2');
4 insert into test values('192.168.10.1(echo)');
5 insert into test values('192.168.10.1(echo),192.168.1.21(ech1),192.168.1.22');
6 end;
7 /
PL/SQL procedure successfully completed
SQL> select path, regexp_replace(path, '[\(].+[\)]', '') newpath from test;
PATH NEWPATH
---------------------------------------------------- --------------------------------------------------------------------------------
192.168.10.1(echo),192.168.1.21 192.168.10.1,192.168.1.21
192.168.10.2 192.168.10.2
192.168.10.1(echo) 192.168.10.1
192.168.10.1(echo),192.168.1.21(ech1),192.168.1.22 192.168.10.1,192.168.1.22
SQL> drop table test purge;
Table dropped
SQL>