create or replace procedure proc1(p_collageid in number)
is
begin
for v_stuid in (select ts.stuid
from
(select
stuid,rownum rn
from
(select stuid from totalscore where total>(select grade from college where collegeid = p_collageid)
and firstwill = p_collageid
order by total desc)) ts,college col
where
col.collegeid = p_collageid
and
ts.rn < col.plan_total) loop
dbms_output.put_line(v_stuid.stuid);
end loop;
end;
如上所示,我希望能夠得到游標一共輸出了幾行資料,或者說是幾個資料,可否在存盤程序中添加一個內部的變數,使其在for回圈中自加 1打到,或者需要定義一個全域變數,或者有其他方式,求指點,謝謝各位大佬。
uj5u.com熱心網友回復:
可以使用 out 型 引數,最后回傳給呼叫者。uj5u.com熱心網友回復:
并不需要這個引數輸出,只在內部使用并對資料庫進行一次修改
uj5u.com熱心網友回復:
就把你的 dbms_output,換成 update 就可以了。轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/90774.html
標籤:基礎和管理
上一篇:初學,有疑問請大神解答
