An anonymous block program to write the record to a row
SQL>
SQL> CREATE TABLE emp
2 (emp_id INTEGER NOT NULL
3 ,fname VARCHAR2(30 CHAR) NOT NULL
4 ,mid_name VARCHAR2(1 CHAR)
5 ,lname VARCHAR2(30 CHAR) NOT NULL
6 ,CONSTRAINT emp_pk PRIMARY KEY (emp_id));
Table created.
SQL>
SQL>
SQL>
SQL> DECLARE
2
3
4 emp1 emp%ROWTYPE;
5
6 BEGIN
7
8
9 emp1.emp_id := 1;
10 emp1.fname := 'John';
11 emp1.mid_name := 'D';
12 emp1.lname := 'R';
13
14
15 INSERT INTO emp VALUES (emp1.emp_id ,emp1.fname ,emp1.mid_name,emp1.lname);
16
17
18 COMMIT;
19
20 END;
21 /
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>
SQL> drop table emp;
Table dropped.
SQL>
Related examples in the same category