Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: %rowtype
jim agans wrote:
>Hi,
> I have 2 tables defined exactly the same...is there a way I can use
>the %rowtype to facilitate this process?
>
> -- define record type
> --
> R_ccc_1 CCC_1%ROWTYPE;
> --
> -- insert this customer in to CCC_2 from CCC_1
> --
> SELECT(*) -- I need all the fields from here can I cheat and
>not put all fields in a list?
> INTO
> R_ccc_1
> from CCC_1
> WHERE CCC_1.CUSTOMER_NUMBER = V_CUST_NUMBER;
> --
> -- then insert in to the ccc_2 table
> --
> INSERT INTO
> CCC_2
> VALUES
> (R_CCC_1); -- can this be done?
>
>
Why didn't you just try it?
And why in a relational database would you have two tables with the exact same column definitions? Did someone miss the lecture on normalizing data? ;-)
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Wed Sep 10 2003 - 19:00:15 CDT