.Net  

CREATE OR REPLACE PROCEDURE abcde(mgr in number)
as
  type t_pubapplyrow  is record(
  v_empno  number(4),
  v_ename  varchar2(10)
 );
  v_mgr emp.mgr%type;
  type cur_test is ref cursor;
  emp_cur cur_test;
  v_var t_pubapplyrow;
BEGIN
  v_mgr:=mgr;
  OPEN emp_cur FOR  select empno,ename from emp where  mgr in(select distinct mgr from emp);
  loop
  fetch emp_cur into v_var;
  exit when emp_cur%notfound;
  insert into temp_tbl(empno,ename) values(v_var.v_empno,v_var.v_ename);
  end loop;
  close  emp_cur;
  commit;
exception
 when others then
 rollback;
end;


 

posted on 2007-08-12 17:05  东方新秀  阅读(608)  评论(0)    收藏  举报