使用来自ftp位置的csv在oracle中创建外部表

时间:2014-03-04 13:07:55

标签: sql oracle csv external-tables

我正在尝试将csv文件数据加载到external_tables中,我试过了

  create table ext_table_csv (
      i   Number,
      n   Varchar2(20),
      m   Varchar2(20)
    )
    organization external (
      type              oracle_loader
      default directory ext_dir
      access parameters (
        records delimited  by newline
        fields  terminated by ','
        missing field values are null
      )
      location ('f

ile.csv')
)
reject limit unlimited;

但我得到了错误

Error starting at line 8 in command:

    create table ext_table_csv (
      i   Number,
      n   Varchar2(20),
      m   Varchar2(20)
    )
    organization external (
      type              oracle_loader
      default directory ext_dir
      access parameters (
        records delimited  by newline
        fields  terminated by ','
        missing field values are null
      )
      location ('f

ile.csv')
)
reject limit unlimited


Error at Command Line:15 Column:23
Error report:

    SQL Error: ORA-06564: object DATA_DIR does not exist
    06564. 00000 -  "object %s does not exist"
    *Cause:    The named object could not be found.  Either it does not exist
               or you do not have permission to access it.
    *Action:   Create the object or get permission to access it.

我要做的是我想从ftp位置读取csv文件。有没有办法实现这个目标?

1 个答案:

答案 0 :(得分:0)

您可能需要指定文件的位置。

 location (FTP_DIRECTORY:'emp.dat')

其中FTP_DIRECTORY是指向您放置位置的Oracle Directory对象 文件。