日期:2014-05-17 浏览次数:20757 次
create or replace procedure p_stuinfo is v_sql varchar2(200); stu_cur sys_refcursor; v_stuid varchar2(10); v_stuname varchar2(12); v_score varchar2(10); begin EXECUTE IMMEDIATE 'create table system.t_studentinfo( stuid varchar2(10), stuname varchar2(12), score varchar2(10) )'; EXECUTE IMMEDIATE 'insert into system.t_studentinfo values(''1'',''张三'',''A'')'; EXECUTE IMMEDIATE 'insert into system.t_studentinfo values(''2'',''李四'',''B'')'; commit; v_sql:= 'select stuid,stuname,score from system.t_studentinfo'; open stu_cur for v_sql; loop fetch stu_cur into v_stuid,v_stuname,v_score; exit when stu_cur%notfound; dbms_output.put_line(v_stuid||' '||v_stuname||' '||v_score); end loop; end;
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html