pengdali(大力 V3.0) 请进---急--在线等....................
pengdali(大力 V3.0) :我测试了,出了错误:
存储过程如下:
procedure pro_cx_test(my_cur in out my_cursor) is
-- v_dw char(2) default '03';
sqlstr varchar2(4000);
cursor c_bm is select distinct bm_bm from gdzckp where dw_bm=v_dw;
-- TYPE my_cursor is REF CURSOR;
-- my_cur my_cursor;
begin
for v_bm in c_bm loop
sqlstr:=sqlstr||',sum(decode(bm_bm,'''||v_bm.bm_bm||''',sl,0)) '|| v_bm.bm_bm;
end loop;
--这句做调试用
dbms_output.put_line('select flmc,count(*) 合计'||sqlstr||' from gdzckp where dw_bm='''||v_dw||''' group by flmc');
open my_cur FOR 'select flmc,count(*) 合计'||sqlstr||' from gdzckp where dw_bm='''||v_dw||''' group by flmc';
end pro_cx_test;
错误出现在:
open my_cur FOR 'select flmc,count(*) 合计'||sqlstr||' from gdzckp where dw_bm='''||v_dw||''' group by flmc';
错误信息:
异常详细信息: Oracle.DataAccess.Client.OracleException: ORA-00923: 未找到预期 FROM 关键字 ORA-06512: 在"GDZC.PKG_GDZC_CX", line 238 ORA-06512: 在line 1
dbms_output的结果为:
select flmc,count(*) 合计,sum(decode(bm_bm,'03',sl,0)) 03 from gdzckp where dw_bm='03' group by flmc
我该怎么办?