oracle 外部表生成外部表脚本

Posted xuzhong86

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 外部表生成外部表脚本相关的知识,希望对你有一定的参考价值。

-------------demo.ctl
LOAD DATA
INFILE *
INTO TABLE DEPT
APPEND
FIELDS TERMINATED BY ,
(
   DEPTNO,
   DNAME,
   LOC,
   LAST_UPDATA
)
BEGINDATA
10,Sales,Virginia,2015-01-01
20,Accounting,Virginia,2016-01-01
使用external_table=generate_only会在日志文件中生成对应的脚本
sqlldr userid=scott/dcjet control=d:\tmp\demo.ctl log=d:\tmp\demo.log parallel=y  external_table=generate_only
启用并行 DML: ALTER SESSION ENABLE PARALLEL DML


用于外部表的 CREATE TABLE 语句:
------------------------------------------------------------------------
CREATE TABLE "SYS_SQLLDR_X_EXT_DEPT2" 
(
  "DEPTNO" NUMBER(38),
  "DNAME" VARCHAR2(100),
  "LOC" VARCHAR2(100),
  "LAST_UPDATA" DATE
)
ORGANIZATION external 
(
  TYPE oracle_loader
  DEFAULT DIRECTORY SYS_SQLLDR_XT_TMPDIR_00000
  ACCESS PARAMETERS 
  (
    RECORDS DELIMITED BY NEWLINE CHARACTERSET ZHS16GBK
    BADFILE SYS_SQLLDR_XT_TMPDIR_00000:demo.bad
    LOGFILE SYS_SQLLDR_XT_TMPDIR_00000:demo.log_xt
    READSIZE 1048576
    SKIP 12
    FIELDS TERMINATED BY "," LDRTRIM 
    REJECT ROWS WITH ALL NULL FIELDS 
    (
      "DEPTNO" CHAR(255)
        TERMINATED BY ",",
      "DNAME" CHAR(255)
        TERMINATED BY ",",
      "LOC" CHAR(255)
        TERMINATED BY ",",
      "LAST_UPDATA" CHAR(255)
        TERMINATED BY ","
        DATE_FORMAT DATE MASK yyyy-mm-dd
    )
  )
  location 
  (
    demo.ctl
  )
)REJECT LIMIT UNLIMITED


用于加载内部表的 INSERT 语句:
------------------------------------------------------------------------
INSERT /*+ append */ INTO DEPT2 
(
  DEPTNO,
  DNAME,
  LOC,
  LAST_UPDATA
)
SELECT 
  "DEPTNO",
  "DNAME",
  "LOC",
  "LAST_UPDATA"
FROM "SYS_SQLLDR_X_EXT_DEPT2"


用于清除由以前的语句创建的对象的语句:
------------------------------------------------------------------------
DROP TABLE "SYS_SQLLDR_X_EXT_DEPT2"

 

以上是关于oracle 外部表生成外部表脚本的主要内容,如果未能解决你的问题,请参考以下文章

Oracle 11g - 使用序列中的常量值填充表行

在 Kotlin 中单击外部时如何关闭底部工作表片段?

Oracle外部表

oracle11g,18存储结构:暂时表,手工条带化,表/索引迁移表空间,删除表,外部表

Oracle 11G、外部表和 .csv 文件

Oracle外部表详解