create or replace procedure cp_DialSrvlevelStat( userid in int, bgdate in date, enddate in date, month_ in int, year_ in int, isvalid in int ) is begin select userid,sum(to_number(servicelevel)) from trunklog where
(userid is null or userid = userid) and (bgdate is null or dialtime >= bgdate) and (enddate is null or dialtime >= enddate) and (month_ is null or to_char(dialtime, 'mm ') = month_) and (year_ is null or to_char(dialtime, 'yyyy ') = year_) and (isvalid is null or servicetime > 0) group by userid;
end cp_DialSrvlevelStat;
执行提示错误:PLS-00428:在此 SELECT 语句中缺少 INTO 子句
请问应该怎么修改?
最新回答
我是太阳啊
2024-04-20 02:14:31
select出来的结果要放到变量中去,select ... into .... from ... where ....
create or replace procedure cp_DialSrvlevelStat( userid in int, bgdate in date, enddate in date, month_ in int, year_ in int, isvalid in int ) is --自己声明一个变量TEMP TEMP VARCHAR2(128); begin --使用into 子句 select sum(to_number(servicelevel)) into TEMP from trunklog where end cp_DialSrvlevelStat;