Thursday, September 20, 2018

Creating External Table and Using - Oracle Database


Step1: Create or get the name of Public Database Directory

SELECT * FROM  ALL_DIRECTORIES WHERE DIRECTORY_NAME LIKE 'DIRNAME%'

CREATE OR REPLACE directory temp_files_dir AS '/temp/sql';

Step2: Check if there are read/write permission on the given path of dir
Step3: Place the file into dir
Step4. Create Ext Table

Syntax: for Creating external tables

CREATE TABLE temp_external_table_ext
  (
     column1 VARCHAR2(500),
     column2 VARCHAR2(500)

  ) organization external 
( TYPE oracle_loader 
DEFAULT directory temp_files_dir 
ACCESS parameters 
( records delimited BY newline 
 badfile 'bad_%a_%p.bad' 
 LOGFILE 'log_%a_%p.log' 
 fields terminated BY ',' 
missing field VALUES are NULL 
( Column1 CHAR(500), 
  Column2 CHAR(500)
 ) 
)
location ('file.csv') ) 
PARALLEL 5 reject limit UNLIMITED; 

No comments:

Post a Comment

What is the process of getting a permanent driving license after getting learning license in Noida? Please answer in detail.

This also answers “Uttar Pradesh - How to Obtain a Learner Driver Licence? ” No Agent, No Third Party. To get your driving license is...