create or replace procedure salestables (v_year in varchar2, info_cursor out testpackage.info_cursor--, --status_cursor out testpackage.status_cursor ) is v_d varchar(50); v_sa varchar(50); v_pri number; v_sql varchar2(3000); --v_sql_status varchar2(1000); begin v_sql:='select d_date,count(d_date)sa,sum(price) pri from (select t.订单ID did,substr(t.订购日期,1,7) d_date,t.是否已付 status,d.单价*数量 price,d.折扣 perc from 订单 t left join 订单明细 d on t.订单id=d.订单id) tt where d_date like :v_year group by d_date order by d_date'; open info_cursor for v_sql using v_year ||'%'; --execute immediate v_sql; /* fetch info_cursor into v_d,v_sa,v_pri; while info_cursor%found loop dbms_output.put_line(v_d||' '||v_sa||' '||v_pri); fetch info_cursor into v_d,v_sa,v_pri; end loop; */ end salestables; 我写了如上过程 按道理说应该能返回数据集啊,但是为什么返回数据集为空呢? |