日期:2014-05-17  浏览次数:20920 次

把查询的结果作为数据参数输出,创建过程后提示带警告
create or replace procedure serch_sum (sumb11 out number,ddate String)
is
begin
 sumb11 := select sum(combank) from bank where com=101 and ddate between to_date(ddate+' 00:00:00','yyyy-mm-dd') and to_date(ddate+' 23:00:00','yyyy-mm-dd');
end;

提示编译完成但带有警告,我需要把查询出来的值作为输出参数传出去

------解决方案--------------------
探讨
sumb11 := select sum(combank) from bank where com=101 and ddate between to_date

------解决方案--------------------
SQL code
create or replace procedure serch_sum(sumb11 out number, ddate String) is
begin
  select sum(combank)
    into sumb11
    from bank
   where com = 101
     and ddate between to_date(ddate + ' 00:00:00', 'yyyy-mm-dd') and
         to_date(ddate + ' 23:00:00', 'yyyy-mm-dd');
end;