Exforsys

Home arrow Reviews arrow Oracle Database Management Utilities

Oracle Utilities - Dynamically Changing the External Reference

Author: Packt Publishing     Published on: 19th Jan 2010

When managing External Tables, there should be an easy way to redefine the external source file. It is enough to change the External Table properties by means of an ALTER TABLE command.

 

Ads

Let's create a stored procedure that performs this task by means of a dynamically generated DDL command. This procedure, named Change_External_Table redefines the location property. Using a stored program unit is a flexible way to perform this task.

Sample Code
  1.  
  2.     create procedure change_external_table
  3.     ( p_table_name in varchar2
  4.     , p_file_name in varchar2
  5.     ) is
  6.     begin
  7.     execute immediate 'alter table '
  8.     p_table_name
  9.     ' location ('''
  10.     p_file_name
  11.     ''')'
  12.     exception
  13.     when others
  14.     then
  15.     raise_application_error(sqlcode,sqlerrm)
  16.     end
  17.     /
  18.  
Copyright exforsys.com


Ads

Oracle 11g External Table enhancements

External Tables work the same in 10g and in 11g, so there are no differences when working with these two versions. When working with Data Pump External Tables, and one single row proves defective, the data set reading operation is aborted. An enhancement in this 11g release prevents the data load aborting, thus saving reprocessing time.



 
This tutorial is part of a Oracle Database Management Utilities tutorial series. Read it from the beginning and learn yourself.

Oracle Database Management Utilities

 

Comments