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

Home -> Community -> Usenet -> c.d.o.server -> Re: Inserting PL/SQL records into a table

Re: Inserting PL/SQL records into a table

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Mon, 08 Jul 2002 15:55:08 GMT
Message-ID: <3D29B5AF.C6B8C7FD@exesolutions.com>


John Doe wrote:

> I can do
>
> my_rec my_table%ROWTYPE;
>
> and
>
> select * into my_rec from my_table where rownum<2;
>
> But I cant do
>
> insert into my_table values (my_rec);
>
> This is a bummer.
>
> I want to write a dynamic procedure that takes
>
> rec_insert(table_name_in, record_name_in)
>
> and this procedure would query ALL_TAB_COLUMNS to get all the column names
> for the table and construct the appropriate INSERT statement for EXECUTE
> IMMEDIATE.
>
> The problem is that the record_name_in IN parameter would be a different
> %ROWTYPE variable depending on the table_name_in IN parameter.
>
> How can I do this?
>
> Thanks for any help

INSERT INTO mytable
(fieldone, fieldtwo, fieldthree)
VALUES
(my_rec.fieldone, my_rec.fieldtwo, my_rec.fieldthree);

Daniel Morgan Received on Mon Jul 08 2002 - 10:55:08 CDT

Original text of this message

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