你查询得到的是一个记录集,返回一个记录集处理,或者把记录集插入到一张表中.
如果直接返回数据的话字段名直接在前端处理.create or replace procedure pro_name
s_a mt_se_b%rowtype;
cursor c is select * FROM mt_se_b where b_t=ty;
begin
open c;
loop
fetch c into s_a;
exit when c%notfound;
insert into table(..) values(s_a.字段,....);
end loop;
close c;
commit;
exception
when others then
rollback;
end;
如果直接返回数据的话字段名直接在前端处理.create or replace procedure pro_name
s_a mt_se_b%rowtype;
cursor c is select * FROM mt_se_b where b_t=ty;
begin
open c;
loop
fetch c into s_a;
exit when c%notfound;
insert into table(..) values(s_a.字段,....);
end loop;
close c;
commit;
exception
when others then
rollback;
end;
as
s_a mt_se_b%rowtype;
begin
SELECT * into s_a,b,c FROM mt_se_b --此表是否存在?
where b_t=ty;
end Mt;
/
as
s_a mt_se_b%rowtype;
begin
SELECT * into s_a FROM mt_se_b --此表是否存在?
where b_t=ty;
end Mt;
/
查出一行数据,放入变量s_a中
使用s_a.a,s_a.b,s_a.c得到三个字段的值。
as
v_a mt_se_b.a%type;
v_b mt_se_b.b%type;
v_c mt_se_b.c%type;
begin
SELECT a,b,c into v_a,v_b,v_c FROM mt_se_b --此表是否存在?
where b_t=ty;
end Mt;
/