External Tables: Querying Data From Flat Files in Oracle

ygzhou518發表於2012-03-28
mkdir -p /data1/stream/ygzhou_dir
 
1.1、strings inputScripts.sql 
CREAT OR EREPLACE DIRECTORY dir_dump as '/data1/stream/ygzhou_dir';
CREATE TABLE input(
  id  INT,
  name  VARCHAR2(50)
ORGANIZATION EXTERNAL (
  TYPE ORACLE_LOADER
  DEFAULT DIRECTORY dir_dump
  ACCESS PARAMETERS (
    RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    (
      id     CHAR(5),
      name   CHAR(50)
    )
  LOCATION ('ygzhou.txt')
PARALLEL 5
REJECT LIMIT UNLIMITED;
 
1.2、strings outputScripts.sql 
create table Output
organization external
( type oracle_datapump
default directory dir_dump
location ('output_part1.dat','output_part2.dat')
PARALLEL 2
select owner,table_name,tablespace_name from all_tables where wner='SYSTEM';
 
 
			

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24867586/viewspace-719695/,如需轉載,請註明出處,否則將追究法律責任。

相關文章