If you are (or will be) using 9i,

straight from the manual ....

<manual>
Inserting Records into the Database
A new PL/SQL-only extension of the INSERT statement lets you insert records
into database rows using a single variable of type RECORD or %ROWTYPE
instead of a list of fields. That makes your code more readable and
maintainable. The record type cannot be nested. Also, the number of fields
in the record must equal the number of columns listed in the INTO clause,
and corresponding fields and columns must have compatible datatypes. An
example follows: 

DECLARE
   TYPE EmpRec IS RECORD (
      emp_id    NUMBER(4),
      job_title VARCHAR2(9),
      salary    NUMBER(7,2));
   emp_info EmpRec;
BEGIN
   emp_info.emp_id := 7975;
   emp_info.job_title := 'CLERK';
   emp_info.salary := 1500;
   INSERT INTO emp (empno, job, sal) VALUES (emp_info);
END;


In the example below, you use a %ROWTYPE record. A column list is not needed
because the record contains a field for each column in the database table. 

DECLARE
   dept_info dept%ROWTYPE;
BEGIN
   dept_info.dept_num := 70;
   dept_info.dept_name := 'PERSONNEL';
   dept_info.location := 'DALLAS';
   INSERT INTO dept VALUES (dept_info);
END;

</manual>

HTH
Raj
______________________________________________________
Rajendra Jamadagni              MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art !

*********************************************************************2

This e-mail message is confidential, intended only for the named recipient(s) above 
and may contain information that is privileged, attorney work product or exempt from 
disclosure under applicable law. If you have received this message in error, or are 
not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 
and delete this e-mail message from your computer, Thank you.

*********************************************************************2

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jamadagni, Rajendra
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to