月
月光宝盒
Unregistered / Unconfirmed
GUEST, unregistred user!
drop table top_art;
create table top_art
(top_no number(5),
art_no number(6),
sal_qty number(10,2),
sal_amnt number(10,2)
);
declare
my_art_no article.art_no%TYPE;
my_sal_qty top_art.sal_qty%TYPE;
my_sal_amnt top_art.sal_amnt%TYPE;
my_top_no number(5):=0;
cursor aa1 is
select art_no,sum(sales) sales,sum(sales_amnt) sales_amnt
from tablename1
group by art_no
order by sales_amnt desc;
begin
open aa1;
loop
FETCH aa1 into my_art_no,my_sal_qty,my_sal_amnt;
exit when aa1%NOTFOUND;
my_top_no := my_top_no+1;
if my_top_no < 40 then
insert into top_art values(my_top_no,my_art_no,my_sal_qty,my_sal_amnt)
;
commit;
end if;
end loop;
close aa1;
end;
我将以上SQL语句如下执行,
procedure TForm1.Button1Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Text:=memo1.Text;//memo1中就是以上语句
adoquery1.ExecSQL;
end;
可是不行,说:应用程序定义Parameters 对象的方式不适当,
是怎么回事?如何改?
create table top_art
(top_no number(5),
art_no number(6),
sal_qty number(10,2),
sal_amnt number(10,2)
);
declare
my_art_no article.art_no%TYPE;
my_sal_qty top_art.sal_qty%TYPE;
my_sal_amnt top_art.sal_amnt%TYPE;
my_top_no number(5):=0;
cursor aa1 is
select art_no,sum(sales) sales,sum(sales_amnt) sales_amnt
from tablename1
group by art_no
order by sales_amnt desc;
begin
open aa1;
loop
FETCH aa1 into my_art_no,my_sal_qty,my_sal_amnt;
exit when aa1%NOTFOUND;
my_top_no := my_top_no+1;
if my_top_no < 40 then
insert into top_art values(my_top_no,my_art_no,my_sal_qty,my_sal_amnt)
;
commit;
end if;
end loop;
close aa1;
end;
我将以上SQL语句如下执行,
procedure TForm1.Button1Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Text:=memo1.Text;//memo1中就是以上语句
adoquery1.ExecSQL;
end;
可是不行,说:应用程序定义Parameters 对象的方式不适当,
是怎么回事?如何改?