日期:2014-05-20 浏览次数:20829 次
sql= " set nocount on "+ " declare @maxno varchar(10 )" + " exec GetSequence_bs 'B',6, @maxid out "+ " exec GetSequence_bs B_"+ PID +"',2, @maxno out set "+ "update B set data_ip='"+data_ip+"',pcodeNo='"+pcode+"-'+@maxno,"+ "sendstate=1 where pid='"+id+"'";
BEGIN FOR c IN ( select 你的语句) LOOP UPDATE table1 SET 你的字段=c.rn WHERE 条件; END LOOP; COMMIT; END;
------解决方案--------------------
BEGIN
FOR c IN
( select
count(pcodeNo) as cnt
,pid
from B
where 条件
group by
pid
order by
id )
LOOP
FOR j IN C.cnt LOOP
UPDATE B
SET pcodeNo=j
WHERE 条件;
END LOOP;
END LOOP;
COMMIT;
END;
具体PLSQL语法可能还要自己在调试