日期:2014-05-17  浏览次数:20892 次

急救,大侠,过程出错了!
CREATE OR REPLACE PROCEDURE vsvs(P_lotnumber xx_test_ta.a%TYPE)IS
BEGIN
UPDATE xx_test_employees SET salary = 0 WHERE employeeid = p_lotnumber;
END;
/

xx_test_employeeid表的结构为
C# code

employeeid  name    salary
001         五小越    1200
002         Wilson    1100
003         bryn      1200
004         Beng      5900
005         yes       12000
006         King      8900



xx_test_ta表的结构为
C/C++ code
A
001
002
003
004
005
006


C# code
DECLARE
   v_name VARCHAR2(1000);
BEGIN
  SELECT A INTO v_name FROM xx_kja_test_ta;
  vsvs(v_name);
END;


结果报错了。Ora-01422:exact fetch returns more than requested number of rows


请问,如此写一个过程用来更新数据的!求求!谢谢


------解决方案--------------------
--你的查询语句返回的值多了,要用循环
DECLARE
v_name VARCHAR2(1000);
BEGIN
for i in (SELECT A FROM xx_kja_test_ta)
loop 
vsvs(i.A);
end loop;
END;