作者LovePuma (就爱扑马)
看板Database
标题[SQL ] Oracle update多笔资料写法
时间Thu Apr 22 13:27:56 2010
假设table某一个栏位资料是 1234
我要把他转成 ABCD
所以我就写了一段select case去转换
select Col.A, (select case
when substr(Col.A,1,1)='1' then
'A'
when substr(Col.A,1,1)='2' then
'B'
when substr(Col.A,1,1)='3' then
'C'
when substr(Col.A,1,1)='4' then
'D'
end)
from TABLExxx where PrimaryKey='XXXX'
那我要怎麽把全部的资料Col.A都套用这个去做转换?
update TABLExxx set
( ???? )
where Primary.Key in(
'XXXX1',
'XXXX2',
....
)
( ???? )
这里该怎麽写?
请教一下各位高手
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.124.185.115
1F:推 roywu607:oracle 写 cursor 不是很快吗? 04/22 16:35