SQL> -- create demo table
SQL> create table Employee(
2 ID VARCHAR2(4 BYTE) NOT NULL,
3 First_Name VARCHAR2(10 BYTE),
4 Salary Number(8,2)
5 )
6 /
Table created.
SQL>
SQL> -- display data in the table
SQL> select * from Employee
2 /
no rows selected
SQL>
SQL> create or replace procedure p_insertNewEmp(i_deptno VARCHAR)
2 is
3 v_emp_rec employee%ROWTYPE;
4 begin
5 select max(id)+1 into v_emp_rec.id from employee;
6
7 v_emp_rec.first_Name:='Emp#'||v_emp_rec.id;
8 v_emp_rec.id :=i_deptno;
9 v_emp_rec.salary := v_emp_rec.salary+1;
10 insert into employee values v_emp_rec;
11 end;
12 /
Procedure created.
SQL>
SQL> call p_insertNewEmp('01');
Call completed.
SQL>
SQL> select * from employee;
ID FIRST_NAME SALARY
---- -------------------- ----------
01 Emp#
SQL>
SQL> -- clean the table
SQL> drop table Employee
2 /
Table dropped.