Tuesday, August 21, 2012

Insert %rowtype variable directly into a table

Can I insert a %rowtype variable directly into table without specifying each column?
Ans: Yes

 Normally we are putting open and closed brackets after values. Remove these brackets in the case %rowtype variable.

Syntax:
Insert into << values >><<%rowtype variable>>


eg: 
Procedure create_emp(p_emp_rec In emp%rowtype)
Is
Begin
insert into emp values p_emp_rec;
End create_emp;

No comments: