存储过程中的参数也可以是默认值
举个栗子
SQL> create or replace procedure add_employee( 2 id_param in number, 3 name_param in varchar2, 4 job_param in varchar2 default 'SALESMAN', 5 hire_param in date default sysdate, 6 salary_param in number default 1000) is 7 begin 8 insert into scott.emp(empno,ename,job,hiredate,sal) 9 values(id_param,name_param,job_param,hire_param,salary_param); 10 end add_employee; 11 / 过程已创建。
调用该存储过程。
SQL> begin 2 add_employee(8124,'苏姗'); 3 end; 4 / PL/SQL 过程已成功完成。 SQL> select empno,ename,job,hiredate,sal 2 from scott.emp 3 where empno=8124; EMPNO ENAME JOB HIREDATE SAL ---------- ---------- --------- ---------- ---------- 8124 苏姗 SALESMAN 2015-10-19 1000