你可以先看一下游标总共有几天记录,记下记录数
select count(*) into icount from table ,
然后在处理循环
declare
icount number;
i number:=0;
cursor c is select * from table
begin
select count(*) into icount from table a where ....
open c;
loop
exit when c%notfound;
i:=i+1;
if i=icount then
--在这里做处理;
end if;
end loop;
end;
select count(*) into icount from table ,
然后在处理循环
declare
icount number;
i number:=0;
cursor c is select * from table
begin
select count(*) into icount from table a where ....
open c;
loop
exit when c%notfound;
i:=i+1;
if i=icount then
--在这里做处理;
end if;
end loop;
end;
icount number;
rowi table%type;
i number:=0;
cursor c is select * from table
begin
select count(*) into icount from table a where ....
open c;
loop
fetch c into rowi;
if c%found then
--在这里做一般处理;
else
--在这里做特殊处理;
exit;
end if;
end loop;
end;
num number;
cursor t_sor is
select * from table_name;
begin
select count(1) into num from table_name;
open t_sor;
loop
fetch t_sor into 变量;
exit when t_sor%notfound;
if t_sor%rowcount=num then
...
end if;
end loop;
end;
/
都先求了一次count,影響了效率,有沒有其他方法。
我知道cursor 有屬性,那他有沒有方法,比如MOVENEXT之類的。
第一问题,解决思路在于你如何处理查询结果的表示,也即使用select查询后将结果重新赋值到不同的表就可以了!与datagrid没有关系!
至于第二个问题,不是很清楚你的意思,这个行号是原来就有的,还是仅仅是你对查询结果的一个标识啊?这个应该先搞清楚,至于你说的datagrid增加一列,那是很简单!