Monday, February 12, 2007

Loading data into non-empty table
This information was gethered from
http://www.cise.ufl.edu/~jhammer/classes/Oracle/Oracle_bulk_loader.htm and is useful for others.

LOAD DATAINFILE APPEND INTO TABLE FIELDS TERMINATED BY ''()

If the tables you are loading into already contain data, you have three options:

APPEND
REPLACE
TRUNCATE


APPEND

If data already exists in the table, SQL*Loader appends the new rows to it. If data does not already exist, the new rows are simply loaded. You must have SELECT privilege to use the APPEND option.

REPLACE

With REPLACE, all rows in the table are deleted and the new data is loaded. The table must be in your schema, or you must have DELETE privilege on the table.

The row deletes cause any delete triggers defined on the table to fire. If DELETE CASCADE has been specified for the table, then the cascaded deletes are carried out.

TRUNCATE

Using this method, SQL*Loader uses the SQL TRUNCATE statement to achieve the best possible performance. For the TRUNCATE statement to operate, the table's referential integrity constraints must first be disabled. If they have not been disabled, SQL*Loader returns an error.

Once the integrity constraints have been disabled, DELETE CASCADE is no longer defined for the table. If the DELETE CASCADE functionality is needed, then the contents of the table must be manually deleted before the load begins.

No comments: