日期:2014-05-16 浏览次数:21035 次
--oracle10g create table BREAKOUT ( OBJECTID INTEGER not null, GJ NVARCHAR2(10), RWIDTH NUMBER(38,8), RHEIGHT NUMBER(38,8) ); insert into BREAKOUT (OBJECTID,GJ,Rwidth,Rheight) values (1,'500X600',0,0); insert into BREAKOUT (OBJECTID,GJ,Rwidth,Rheight) values (2,'700X600',0,0); insert into BREAKOUT (OBJECTID,GJ,Rwidth,Rheight) values (3,'300X400',0,0); insert into BREAKOUT (OBJECTID,GJ,Rwidth,Rheight) values (4,'450',0,0); insert into BREAKOUT (OBJECTID,GJ,Rwidth,Rheight) values (4,'550',0,0); select * from BREAKOUT;
update BREAKOUT set RWIDTH = (case when instr(GJ, 'X') > 0 then to_number(substr(GJ, 1, instr(GJ, 'X') - 1)) else to_number(GJ) end), RHEIGHT =(case when instr(GJ, 'X') > 0 then to_number(substr(GJ, instr(GJ, 'X') + 1)) else RHEIGHT end); commit;