17,377
社区成员
发帖
与我相关
我的任务
分享
declare
cursor c is
select *
from spx
where i between 8316 and 8531
and cloc = 'A2-N-1F/2F';
c_row c%rowtype;
begin
for c_row in c loop
dbms_output.put_line(c_row.spx表字段1 || c_row.spx表字段2 || c_row.spx表字段3........ .);
end loop;
end;
declare
--定义变量
v_id number;
v_name varchar2(20);
begin
for i in 8316 .. 8531 loop
select id, name --需要的列数据
into v_id, v_name --需要into变量后使用
from spx --确认有且只有一条结果 没有数据会提示no_data_found 多条数据提示-实际返回的行数超出请求的行数
where casena=i and cloc='A2-N-1F/2F';
dbms_output.put_line('v_id=' || v_id || ' ,v_name=' || v_name);
end loop;
end;