oracle 存储过程一个问题!
try表的内容如下:
cw1,cw2,cw3,cw4,cw5,cs
11 12 13 3
21 22 23 24 4
31 1
41 42 43 44 45 5
51 52 2
其中cs的值与cw的个数相同。
我写的存储过程如下:
set serveroutput on
declare
cursor mycur is select * from try;
v_try mycur%rowtype;
ii number(3);
kk number(2);
begin
for v_try in mycur loop
kk:=v_try.cs;
for j in 1..kk loop
ii:=v_try.cw&&j;
DBMS_OUTPUT.PUT_LINE(to_char(ii));
end loop;
end loop;
end;
通过读取cs的值,实现try表中cw&i值的动态输出。