create or replace procedure get_count is m number; begin select count(*) into m from a where to_char(savetime,'hh')=to_char(sysdate,'hh'); dbms_output.put_line('总记录数:'||m); end get_count;
要不要定义一个out变量: m out VARCHAR2?
按照你的意思,这样也可以:create or replace procedure get_count(m out number) is begin select count(*) into m from a where to_char(savetime,'hh')=to_char(sysdate,'hh'); end get_count;
直接sql就可以呀select count(1) from tabel1 where trunc(savetime,'hh') = trunc(sysdate,'hh');
is
m number;
begin
select count(*) into m
from a
where to_char(savetime,'hh')=to_char(sysdate,'hh');
dbms_output.put_line('总记录数:'||m);
end get_count;
按照你的意思,这样也可以:create or replace procedure get_count(m out number)
is
begin
select count(*) into m
from a
where to_char(savetime,'hh')=to_char(sysdate,'hh');
end get_count;
直接sql就可以呀select count(1) from tabel1 where trunc(savetime,'hh') = trunc(sysdate,'hh');