In oracle External Tables can be used to read data from external flat files. The flat file(s) is mapped to the external table in the oracle schema. The following is an example to create an external table which is mapped to two flat files emp_ext1.dat and emp_ext2.dat which are present in the directory defined by ext_tables.
CREATE TABLE emp_ext
(
empcode NUMBER(4),
empname VARCHAR2(25),
deptname VARCHAR2(25),
hiredate date
)
ORGANIZATION EXTERNAL
(
TYPE ORACLE_LOADER
DEFAULT DIRECTORY ext_tables
ACCESS PARAMETERS
(
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
)
LOCATION ('emp_ext1.dat','emp_ext2.dat')
)
REJECT LIMIT UNLIMITED;
A directory can be defined in oracle using the following command.
CREATE OR REPLACE DIRECTORY EXT_TABLES AS 'C:\Nirmala';
All the error messages corresponding to External Tables can be found at this site
http://www.cs.utah.edu/classes/cs5530/oracle/doc/B10501_01/server.920/a96525/kupus.htm
More about External Tables can be found on the oracle pl/sql online documentation at
http://www.cs.utah.edu/classes/cs5530/oracle/doc/B10501_01/index.htm
No comments:
Post a Comment