0
嘿,我建立這個存儲過程:變量不能SQL語句之外使用
CREATE OR REPLACE procedure fillCompanyWH
IS
cursor c is select other_line_key from line_contact;
cursor e is select max(comp_id) + 1 from Company_WH;
r c%ROWTYPE;
count PLS_INTEGER:=0;
rr NUMBER(9);
BEGIN
open c;
open e;
fetch e into rr;
if(rr is null) THEN
rr:=1;
end if;
count:= rr;
loop
count :=count + 1;
fetch c into r;
exit when c%NOTFOUND;
insert into Company_WH (comp_id, comp_key) values (count,r.other_line_key);
end loop;
close c;
close e;
END;
/
它不斷給我說說這行的錯誤(計數:= COUNT + 1) 錯誤說(語句被忽略的函數或僞列'COUNT'只能在SQL語句中使用)。
爲什麼?
非常感謝我不知道:) – Lisa 2011-12-25 00:32:33