定义过程:
create [or replace] procedure procedure_name[(argument [in|out|in out] argument_type [,...])]
is|as
begin
procedure_body
end [procedure_name];
输出某部门全部员工:
create or replace procedure emp_by_dno(dno emp.deptno%type)
is
cursor emp_c is select * from emp where deptno = dno;
emp_v emp_c%rowtype;
begin
open emp_c;
loop
fetch emp_c into emp_v;
exit when emp_c%notfound;
dbms_output.put_line(emp_v.ename);
end loop;
close emp_c;
end emp_by_dno;
/