Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Multi-table inserts and Oracle records
While reading "Oracle PL/SQL Programming" I came across the section on
RECORDs being able to be
used for DML operations such as INSERT and UPDATE.
I easily understand the example(s) given for the single table INSERT and
UPDATE but could not find
an example for a multi-table insert and was wondering if a multi-table
insert such as:
INSERT FIRST WHEN ( table_code = '1' ) THEN
INTO table_one
( field_one,
field_two, field_three ) VALUES
( field_one,
field_two, field_three )
WHEN ( table_code = '2' ) THEN
INTO table_two
( field_one,
field_two, field_three ) VALUES
( field_one,
field_two, field_three ) SELECT field_one AS field_one, field_two AS field_two, field_three AS field_three
Could possibly be re-written as something like:
INSERT FIRST WHEN ( table_code = '1' ) THEN
INTO table_one VALUES field_rec
WHEN ( table_code = '2' ) THEN
INTO table_two VALUES field_rec
SELECT field_one AS field_one, field_two AS field_two, field_three AS field_three