把存储过程里的
a.hurttime>=to_date('"+start_time+"','yyyy-MM-dd hh:mi:ss') and a.hurttime<=to_date('"+end_time+"','yyyy-MM-dd hh:mi:ss') group by ....改为
a.hurttime>=start_time and a.hurttime<=end_time group by ...
a.hurttime>=to_date('"+start_time+"','yyyy-MM-dd hh:mi:ss') and a.hurttime<=to_date('"+end_time+"','yyyy-MM-dd hh:mi:ss') group by ....改为
a.hurttime>=start_time and a.hurttime<=end_time group by ...
确定当前会话的日期型显示格式为'yyyy-mm-dd hh24:mi:ss'alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
set serveroutput on;
declare
v_out number(10,0);
begin
getHurtNoDieCount('2005-01-01 10:10:10','2005-07-20 10:10:10',v_out);
dbms_output.put_line(v_out);
end;
/
getHurtNoDieCount(SYSDATE-10,SYSDATE-1,v_out);
SQL> declare
2 v_out number(10,0);
3 begin
4 getHurtNoDieCount('2005-01-01 10:10:10','2005-07-20 10:10:10',v_out);
5 dbms_output.put_line(v_out);
6 end;
7 /
declare
*
ERROR 位于第 1 行:
ORA-01422: 实际返回的行数超出请求的行数
ORA-06512: 在"MK2005.GETHURTNODIECOUNT", line 4
ORA-06512: 在line 4
改为
select count(count(*)) into ...
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';