Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Inserting PL/SQL records into a table
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
![]() |
![]() |