Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How to insert PL/SQL records into table
How can I use PL/SQL records to insert values into a table.
E.g., suppose I have a table:
CREATE TABLE Employee
{
Id NUMBER,
Name VARCHAR2(50),
Title VARCHAR2(50),
Salary NUMBER
};
In my PL/SQL code, I have Employee records, e.g.
Emp Employee%ROWTYPE;
These records may be populated by routines in other packages, etc.
Given a populated Employee%ROWTYPE record, I would like a simple way to insert it into the Employee table.
What I'm looking for is something like:
INSERT INTO Employee Emp;
That doesn't work.
Of course for this little table, it's easy enough to do
INSERT INTO Employee VALUES (Emp.Id, Emp.Name, Emp.Title, Emp.Salary);
But that doesn't scale too well to tables with 150 or more columns.
Is there a straightforward way to do this? Received on Wed Jul 01 1998 - 15:02:20 CDT
![]() |
![]() |