database 在oracle中选择一个计数到一个变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7108284/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 08:18:54 来源:igfitidea点击:
Selecting a count into a variable in oracle
提问by MozenRath
Hi I have been trying this today and haven't had any luck. this stored procedure does not work :(
嗨,我今天一直在尝试这个,但没有任何运气。这个存储过程不起作用:(
CREATE OR REPLACE PROCEDURE LEAD_PURGE(closed IN DATE,
oprtr IN INTEGER,
leadscount OUT INTEGER)
is
BEGIN
SELECT COUNT(*) FROM LEADS_DELETED INTO leadscount;
COMMIT;
END LEAD_PURGE;
回答by Tony Andrews
The INTO clause is misplaced. It should be:
INTO 子句放错了位置。它应该是:
SELECT COUNT(*) INTO leadscount FROM LEADS_DELETED
回答by René Nyffenegger
you have the intoat the wrong place.
你into在错误的地方。
Try something like this instead and proceed from there:
尝试这样的事情,然后从那里开始:
declare
cnt number;
begin
select count(*)
into cnt
from leads_delete;
end;

