请教ORACLE 怎么截取字符串

如:【55-皇宫饭店】==【世纪大厦-111】==【移通大厦-9】 处理为 55-皇宫饭店、世纪大厦-111、移通大厦-9 保存为三个记录写到表格中作为一列
最新回答
时间曼妙

2025-02-25 03:15:50

select
substr(B,INSTR(B,'【',1,1)+1,INSTR(B,'】',1,1)-INSTR(B,'【',1,1)-1),
substr(B,INSTR(B,'【',1,2)+1,INSTR(B,'】',1,2)-INSTR(B,'【',1,2)-1),
substr(B,INSTR(B,'【',1,3)+1,INSTR(B,'】',1,3)-INSTR(B,'【',1,3)-1)
from tablename
B表示列名 这个是分割字符串的。。。 插入你自己做吧
视水若沙

2025-02-25 08:05:03

insert into select
substr(B,INSTR(B,'【',1,1)+1,INSTR(B,'】',1,1)),
substr(B,INSTR(B,'【',1,2)+1,INSTR(B,'】',1,2)),
substr(B,INSTR(B,'【',1,3)+1,INSTR(B,'】',1,3))
from table