RE: A question on table export

From: Elliott, Patrick <patrick.elliott_at_medtronic.com>
Date: Tue, 1 Jul 2008 09:28:25 -0500
Message-ID: <3B8B6A1700202C43A89D61CE495C894E0F11B5E399@MSPM1BMSGM103.ent.core.medtronic.com>


The only reason that I can think of to import into the same schema is to maybe prevent the rollback segment from filling up undo or you are getting snapshot too old. If you are having trouble with too many rows on the insert, then you just need to code the insert in pl/sql with intermediate commits.

DECLARE
  CURSOR c1 IS
    SELECT *
      FROM source_table;
  row_cnt NUMBER := 0;
BEGIN
  FOR r1 IN c1 LOOP
    INSERT INTO destination_table
    VALUES (r1.col1, r1.col2, ... r1.coln);     row_cnt := row_cnt +1;
    IF row_cnt > 1000 THEN

      COMMIT;
      row_cnt := 0;

    END IF;
  END LOOP;
  COMMIT;
END;
/

Just change the 1000 to a higher or lower number depending on your requirements. Change source_table and destination_table to the real table names and col1, col2, .. to the real column names.

Pat



From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Anurag Verma Sent: Monday, June 30, 2008 6:10 PM
To: ORACLE-L
Subject: A question on table export

I have an Oracle 9i (9.2.0.7.0) database.

One question on table export.

Can we export a table and import into another table (which has the same structure)?

Both the tables are in the same schema.

Thanks,

--

Anurag Verma,
Database Administrator
ERCOT(Electric Reliability Council of Texas), Texas 76574

[CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain information that is private, privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please delete this mail from your records. To view this notice in other languages you can either select the following link or manually copy and paste the link into the address bar of a web browser: http://emaildisclaimer.medtronic.com

--

http://www.freelists.org/webpage/oracle-l Received on Tue Jul 01 2008 - 09:28:25 CDT

Original text of this message