create or replace procedure add_emp (p_ename emp.ename%type, p_job emp.job%type default 'CLERK', p_mgr emp.mgr%type default 7698, p_hiredate date default sysdate, p_sal emp.sal%type default 1000, p_comm emp.comm%type default null, p_deptno emp.deptno%type default 30 ) is begin if valid_deptno(p_deptno) then insert into emp values (seq_empno.nextval, p_ename, p_job, p_mgr, p_hiredate, p_sal, p_comm, p_deptno); else raise_application_error(-20000,'部门不存在'); end if; end; /
create or replace function get_ename (p_empno number, p_ename out varchar2) return number is v_sal number; begin select ename,sal into p_ename,v_sal from emp where empno=p_empno; return v_sal; end; /
var g_ename varchar2(10) var g_sal number exec :g_sal:=get_ename(7369,:g_ename);
|