各位高淫 小弟今天卡到一个问题上了`````特来此求助```分不多了`````
oracle的数据 一张表a 里面有个字段 里面全是 20,30,30,200,
在a表里面还有个空字段 就是要把上面这个字段以逗号分割开 取第二项的值乘以100 也就是30*100
望各位高淫赐教两招
我用程序实现了这功能 但是效率太慢了 一共33W条数据 请问有没什么SQL语句能够搞定的````查了很久都没找到
------解决方案--------------------------------------------------------
- SQL code
create table tt as select '20,30,40' as t from dual ;select t,substr(t1,0,instr(t1,',')-1)*10 as t1 from(select t,substr(t,instr(t,',')+1) as t1 from tt);drop table tt;/*T T120,30,40 300*/
------解决方案--------------------------------------------------------
update table set field2 = 100*TO_NUMBER(substr(field1,instr(field1,',')+1,instr(field1,',',1,2)-instr(field1,',')-1))
------解决方案--------------------------------------------------------