日期:2014-05-17 浏览次数:20715 次
create or replace procedure haha(in_deptno in number,in_order in varchar2) is v_sql varchar2(1000):='select ename from emp where deptno='||in_deptno||'order by'||in_order; out_info pack1.my_cursor; v_ename emp.ename%type; begin open out_info for v_sql; loop fetch out_info into v_ename; exit when out_info%notfound; dbms_output.put_line(v_ename); end loop; close out_info; end;
--order by的两边少了空格 v_sql varchar2(1000):='select ename from emp where deptno='||in_deptno||' order by '||in_order;