Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> How to insert PL/SQL records into table

How to insert PL/SQL records into table

From: Alan <apage_at_exchane.ml.com>
Date: Wed, 01 Jul 1998 16:02:20 -0400
Message-ID: <359A95CB.F5641A74@exchane.ml.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US