Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
   
External Tables in Oracle 10g




By Vigyan Kaushik
Mar 07, 2008

Digg! digg!     Print    email to friend Email to Friend

Note: This article was written for educational purpose only. Please refer to the related vendor documentation for detail.




Download Free Confio Software

External Tables in Oracle 10g

Overview:

External table in Oracle are a representation of external data in a file. These tables are not stored in the database. Oracle first introduced External tables in 9i database however you could only read from external tables. Now in Oracle 10g, you can also write in the external tables. In the article below, we will describe the mechanism of creating external tables.

Creating External Tables:

There are three steps in creating external tables.

  1. Create the datafile
  2. Create the directory object
  3. Create the external table

Create The Datafile:

Create some sample data file called "org_data.txt" that we will load in the table.

Create The Directory Object:

Create the directory object to hold the external datafile as sys user.

SQL> create or replace directory org_data as 'C:\Oracle\External_files\org_data';

Create External Table:

Before creating table issues the grant read,write on directory" to user where you want to create the external table.

SQL> Grant Read, Write on directory org_data to vigyan;

Create the external table as follows

SQL> Connect as vigyan@db

SQL> Create table org_external (
                    empid    number(10),
                    ename    varchar2(50),
                    dept    varchar2(50),
                    start_date    varchar2(50)
                    )
organization external (
                    Type Oracle_Loader
                    Default Directory org_data
                    Access Parameters
                    (
                    Records Delimited by Newline
                    Fields Terminated by ','
                    Missing Field Value Are Null
                    )
                    Location ('org_data.txt')
                    )
                    Reject Limit Unlimited;

The table Org_External is created and ready to query.

Environment: This article has been written in the following environment.
Operating System: Windows XP
Database: Oracle 10g R2
 

 

 
About author:

Vigyan Kaushik is an Oracle certified professional serving IT industry for more than 10 years as an Oracle DBA and System Administrator. He has expertise in Database Designing, Administration, Networking, Tuning, Implementation, Maintenance with web deployment activities on different Unix flavors as well as on Windows Operating Systems.

 

Please login to post your comments





  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software