调用
oracle存储过程 没结果出来,为什么
SQL> create or replace procedure DGReport
2 (
3 b_time in DATE,
4 b_wfxw out varchar2,
5 b_wfxwCOUNT out number
6 )
7 AS
8 begin
9 select WFXW,COUNT(*) into b_wfxw, b_wfxwCOUNT from tb_vio_surveil_bd where wfsj =b_time AND JC='京' GROUP BY WFXW;
10 end DGReport;
11 /
Procedure created
SQL>
SQL> dECLARE b_wfxw varchar(10); b_wfxwCOUNT number(10); begin DGReport(to_date('2013/12/30 10:58:00','YYYY-MM-DD HH24:MI:SS'),b_wfxw,b_wfxwCOUNT);
2 end;
3 /
PL/SQL procedure successfully completed
------解决方案-------------------- 引用: SQL> create or replace procedure DGReport
2 (
3 b_time in DATE,
4 b_wfxw out varchar2,
5 b_wfxwCOUNT out number
6 )
7 AS
8 begin
9 select WFXW,COUNT(*) into b_wfxw, b_wfxwCOUNT from tb_vio_surveil_bd where wfsj =b_time AND JC='京' GROUP BY WFXW;
10 end DGReport;
11 /
Procedure created
SQL>
SQL> dECLARE b_wfxw varchar(10); b_wfxwCOUNT number(10); begin DGReport(to_date('2013/12/30 10:58:00','YYYY-MM-DD HH24:MI:SS'),b_wfxw,b_wfxwCOUNT);
2 end;
3 /
PL/SQL procedure successfully completed
将调用存储过程改为如下方式,增加输出
DECLARE
B_WFXW VARCHAR(10);
B_WFXWCOUNT NUMBER(10);
BEGIN
DGREPORT(TO_DATE('2013/12/30 10:58:00', 'YYYY-MM-DD HH24:MI:SS'),
B_WFXW,
B_WFXWCOUNT);
DBMS_OUTPUT.put_line('B_WFXW:' ------解决方案-------------------- B_WFXW);
DBMS_OUTPUT.put_line('B_WFXWCOUNT:' ------解决方案-------------------- B_WFXWCOUNT);
END;
另外,在执行之前,输入如下命令。
set serveroutput on
SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
2 B_WFXW VARCHAR(10);
3 B_WFXWCOUNT NUMBER(10);
4 BEGIN
5 DGREPORT(TO_DATE('2013/12/30 10:58:00', 'YYYY-MM-DD HH24:MI:SS'),
6 B_WFXW,
7 B_WFXWCOUNT);<