ORACLE EXTERNAL TABLES
External tables are defined as tables that do not reside in the database, and can be in anyformat for which an access driver is provided. By providing Oracle with metadatadescribing an external table, Oracle is able to expose the data in the external table as if itwere data residing in a regular database table. The external data can be queried directlyand in parallel using SQL.One can select,Join or Sort External Table data.One can createViews and synonyms for external Tables. However, no DML operations (UPDATE,INSERT, or DELETE) are possible, and no indexes can be created, on external tables.The metadata for external tables is done through the CREATE TABLE ...ORGANIZATION EXTERNAL statement. An access driver is the mechanism used toread the external data in the table.Oracle provides an access driver for external tables. It allows the reading of data fromexternal files using the Oracle loader technology. The ORACLE_LOADER access driver provides data mapping capabilities which are a subset of the control file syntax of SQL*Loader utility.Oracle's external tables feature provides a valuable means for performing basicextraction, transformation, and transportation (ETT) tasks that are common for datawarehousing applications.Lets see the Syntax for creating External Tables from Operating System file.Assume You got the file say EmpETL.DAT in Direcotry C:\Oracle with following data.
7369,SMITH,CLERK , 7902 17-DEC-80,800,200,20 7499,ALLEN,SALESMAN,7698,20-FEB-81,1600,200,30 7521,WARD,SALESMAN,7698,22-FEB-81,1250,200,30 7566, JONES,MANAGER ,7839,02-APR-81,2975,200,20 7654,MARTIN,SALESMAN,7698,28-SEP-81,1250,200,30
The following SQL statements create an external table and load its data into database tableTEMP of User Scott.
SQL>Connect system/managerConnectedSQL> CREATE OR REPLACE DIRECTORY DATA_DIR AS 'C:\Oracle’Directory created.SQL>GRANT READ ON DIRECTORY DATA_DIR TO scott;Grant succeededSQL>CONNECT SCOTT/TIGERCREATE TABLE EMPETL (empno NUMBER(4),ename VARCHAR2(20),