what is External tables? explain with examples
Answer Posted / karkuvelrajan muthusamy
External tables can be used to fetch data from a physical
data file present in the OS path of the database server.. It
is similar to SQL*Loader where oracle reads data from a
datafile and loads into oracle tables.. An external table is
very similar.. Whenever we create an eternal table, oracle
doesnot load data from file instead a table that referes to
the file only is created.. A sample syntax could be as
following:
create table ext_tbl
(e_name varchar2(50),
e_sal number)
ORGANIZATION EXTERNAL(
TYPE ORACLE_LOADER
-- Default->ORACLE_LOADER, Oracle_datapump can also be used
DEFAULT DIRECTORY ext_dir
-- An oracle directory has to be created with
-- name ext_dir
ACCESS PARAMETERS
(
FIELDS TERMINATED BY ','
RECORDS DELIMITED BY NEWLINE
MISSING FIELD VALUES ARE NULL
(e_name, e_sal)
)
LOCATION('file1.txt')
)
The file1.txt should be in the following format:
Kumar,20000
Raj,10000
Patel,34000
Hope this helps.
Regards,
Karkuvelrajan M
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
how to calculate expressions with sql statements? : Sql dba
What is bulk compiling in pl/sql.?
How do I order columns in sql?
Explain the update statement in sql
What is composite data type in pl sql?
How to call shell script from pl sql procedure?
What are the various levels of constraints?
What is an implicit commit?
How do you create a unique index?
What is out parameter used for eventhough return statement can also be used in pl/sql?
What is a table partition?
How long does it take to learn pl sql?
Are dml statements autocommit?
How do I get sql certification?
What is the syntax to add a record to a table?