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


Please Help Members By Posting Answers For Below Questions

Are pl sql variables case sensitive?

765


C. Normalize the following data up to the 3rd Normal form. Create the tables and insert the data given. Emp_ID Name Dept_Name Salary Course_Title Date_Completed 100 Adam Marketing 48,000 SPSS 6/19/2008 Surveys 10/7/2008 140 Bob Accounting 52,000 Tax Acc 12/8/2008 110 Cathy IT SQL Server 1/12/2008 C# 4/22/2008 190 Dan Finance 150 Emily Marketing 55,000 SPSS 6/16/2008 42,000 Analysis 8/12/2008 Queries 1. Find all Names who have completed the SPSS Course. 2. Find employee with max salary. 3. Find employee with 2nd max salary. 4. Find all employees in Dept “Marketing”. 5. Find all the employees who have taken more than 2 courses. 6. Find all the employees who have completed the courses before month of September.

2343


what are the join types in tsql? : Transact sql

751


how to use in conditions? : Sql dba

683


How can you load multi line records? : aql loader

798






Does user triggers have entry for trigger with compilation errors?

782


Which column of the user triggers data dictionary view displays the database event that will fire the trigger?

766


what is uncommittable transactions? : Transact sql

746


how can we know the number of days between two given dates using mysql? : Sql dba

737


Sql technical questions

992


What is embedded sql what are its advantages?

682


Why we use join in sql?

698


what are the authentication modes in sql server? How can it be changed? : Sql dba

950


Do we need to rebuild index after truncate?

690


Write a query to find the names of users that begin with "um" in sql?

694