create an external table
来源:互联网 发布:windows webpack教程 编辑:程序博客网 时间:2024/04/28 10:18
XAMPLE: Creating an External Table and Loading Data
The file empxt1.dat
contains the following sample data:
360,Jane,Janus,ST_CLERK,121,17-MAY-2001,3000,0,50,jjanus361,Mark,Jasper,SA_REP,145,17-MAY-2001,8000,.1,80,mjasper362,Brenda,Starr,AD_ASST,200,17-MAY-2001,5500,0,10,bstarr363,Alex,Alda,AC_MGR,145,17-MAY-2001,9000,.15,80,aalda
The file empxt2.dat
contains the following sample data:
401,Jesse,Cromwell,HR_REP,203,17-MAY-2001,7000,0,40,jcromwel402,Abby,Applegate,IT_PROG,103,17-MAY-2001,9000,.2,60,aapplega403,Carol,Cousins,AD_VP,100,17-MAY-2001,27000,.3,90,ccousins404,John,Richardson,AC_ACCOUNT,205,17-MAY-2001,5000,0,110,jrichard
The following hypothetical SQL statements create an external table in the hr
schema named admin_ext_employees
and load its data into the hr.employees
table.
CONNECT / AS SYSDBA;-- Set up directories and grant access to hr CREATE OR REPLACE DIRECTORY admin_dat_dir AS '/flatfiles/data'; CREATE OR REPLACE DIRECTORY admin_log_dir AS '/flatfiles/log'; CREATE OR REPLACE DIRECTORY admin_bad_dir AS '/flatfiles/bad'; GRANT READ ON DIRECTORY admin_dat_dir TO hr; GRANT WRITE ON DIRECTORY admin_log_dir TO hr; GRANT WRITE ON DIRECTORY admin_bad_dir TO hr;-- hr connects CONNECT hr/hr-- create the external tableCREATE TABLE admin_ext_employees (employee_id NUMBER(4), first_name VARCHAR2(20), last_name VARCHAR2(25), job_id VARCHAR2(10), manager_id NUMBER(4), hire_date DATE, salary NUMBER(8,2), commission_pct NUMBER(2,2), department_id NUMBER(4), email VARCHAR2(25) ) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY admin_dat_dir ACCESS PARAMETERS ( records delimited by newline badfile admin_bad_dir:'empxt%a_%p.bad' logfile admin_log_dir:'empxt%a_%p.log' fields terminated by ',' missing field values are null ( employee_id, first_name, last_name, job_id, manager_id, hire_date char date_format date mask "dd-mon-yyyy", salary, commission_pct, department_id, email ) ) LOCATION ('empxt1.dat', 'empxt2.dat') ) PARALLEL REJECT LIMIT UNLIMITED; -- enable parallel for loading (good if lots of data to load)ALTER SESSION ENABLE PARALLEL DML;-- load the data in hr employees tableINSERT INTO employees (employee_id, first_name, last_name, job_id, manager_id, hire_date, salary, commission_pct, department_id, email) SELECT * FROM admin_ext_employees;
- create an external table
- Using Oracle Data Pump to create an external table
- Using SQL*Loader to create an external table
- Hive create external table partition关联数据文件
- LOCATION issue about create external table
- 96.Which two operations can be performed on an external table? (Choose two.) A.Create a view on the
- trailing nulcols:difference between external table and sqlldr:create external table from controlfile
- Moving Data from HDFS to Hive Using an External Table
- external table
- external table
- Excel--Create an Excel Pivot Table report using VBA
- Tips: Create An Empty Table Has Same Columns with Existed Table
- create table
- CREATE TABLE
- CREATE TABLE
- create table
- Create Table
- Create table
- 利用Ajax技术解析XML文档
- 有用函数不断更新
- NUnit2.0详细使用方法
- 【AVR、PIC、MSP430、ARM经典资料大全】
- MFC 文件的读写(其实还是c++的哪些东西)
- create an external table
- PowerShell 瑞士军刀
- MIT算法导论——第三讲.The Divide-and-Conquer
- 第一章软件工程概论
- 在对话框中 实现重绘
- 同陷信用等级泥潭:松下翻身机会比索尼大
- 优秀开源代码解读之JS与iOS Native Code互调的优雅实现方案
- 题目:判断101-200之间有多少个素数,并输出所有素数。
- VerifyError: Error #1014: 无法找到类 org.spicefactory.lib.errors::CompoundError