Creating an external table.

Please help,
I need to load a csv to an external but i kept running into error.
see the syntax below:
SQL> CREATE TABLE PSOPRDEFN
2 (
3 OPRID VARCHAR2(30 BYTE),
4 VERSION INTEGER ,
5 OPRDEFNDESC VARCHAR2(30 BYTE),
6 EMPLID VARCHAR2(11 BYTE),
7 EMAILID VARCHAR2(70 BYTE),
8 OPRCLASS VARCHAR2(30 BYTE),
9 ROWSECCLASS VARCHAR2(30 BYTE),
10 OPERPSWD VARCHAR2(32 BYTE),
11 ENCRYPTED INTEGER ,
12 SYMBOLICID VARCHAR2(8 BYTE) ,
13 LANGUAGE_CD VARCHAR2(3 BYTE) ,
14 MULTILANG INTEGER ,
15 CURRENCY_CD VARCHAR2(3 BYTE) ,
16 LASTPSWDCHANGE DATE ,
17 ACCTLOCK INTEGER ,
18 PRCSPRFLCLS VARCHAR2(30 BYTE),
19 DEFAULTNAVHP VARCHAR2(30 BYTE),
20 FAILEDLOGINS INTEGER ,
21 EXPENT INTEGER ,
22 OPRTYPE INTEGER ,
23 USERIDALIAS VARCHAR2(70 BYTE),
24 LASTSIGNONDTTM DATE,
25 LASTUPDDTTM DATE,
26 LASTUPDOPRID VARCHAR2(30 BYTE),
27 PTALLOWSWITCHUSER INTEGER
28 )
29 organization external
30 ( default directory extern_table_dir
31 access parameters
32 ( records delimited by newline
33 fields terminated by ','
34 MISSING FIELD VALUES ARE NULL
35 REJECT ROWS WITH ALL NULL FIELDS
36 (
37 "LASTPSWDCHANGE" date 'YYYY-MM-DD',
38 "LASTSIGNONDTTM" date 'YYYY-MM-DD',
39 "LASTUPDDTTM" 'to_timestamp(:LASTUPDDTTM,'YYYY-MM-DD HH:MI:SS')'
40 )
41 )
42 location ('listofuser.txt')
43 )
44 reject limit unlimited;
Table created.
Error:
SQL> select * from psoprdefn;
select * from psoprdefn
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "single-quoted-string": expecting one of:
"binary_double, binary_float, comma, char, date, defaultif, decimal, double,
float, integer, (, nullif, oracle_date, oracle_number, position, raw, recnum,
), unsigned, varrawc, varchar, varraw, varcharc, zoned"
KUP-01007: at line 8 column 19
ORA-06512: at "SYS.ORACLE_LOADER", line 19
Data:
16436,676,John John,16436,john.john@gmalil,POCLANYL, ,OwciRHuJKpBBdJDyyZVo+K8MUqA=,1,FSTSD9,ENG,0, ,2013-01-28,0,POCLANYL,POCLANYL,0,0,0, ,2011-04-07 3:56:55 PM,2011-02-25 4:16:13 PM,63475,0
Please help

Remove line 32 - 62 under clause '35 REJECT ROWS WITH ALL NULL FIELDS'
what I have written
CREATE TABLE PSOPRDEFN
OPRID VARCHAR2(30 BYTE),
VERSION INTEGER ,
OPRDEFNDESC VARCHAR2(30 BYTE),
EMPLID VARCHAR2(11 BYTE),
EMAILID VARCHAR2(70 BYTE),
OPRCLASS VARCHAR2(30 BYTE),
ROWSECCLASS VARCHAR2(30 BYTE),
OPERPSWD VARCHAR2(32 BYTE),
ENCRYPTED INTEGER ,
SYMBOLICID VARCHAR2(8 BYTE) ,
LANGUAGE_CD VARCHAR2(3 BYTE) ,
MULTILANG INTEGER ,
CURRENCY_CD VARCHAR2(3 BYTE) ,
LASTPSWDCHANGE VARCHAR2(10) ,
ACCTLOCK INTEGER ,
PRCSPRFLCLS VARCHAR2(30 BYTE),
DEFAULTNAVHP VARCHAR2(30 BYTE),
FAILEDLOGINS INTEGER ,
EXPENT INTEGER ,
OPRTYPE INTEGER ,
USERIDALIAS VARCHAR2(70 BYTE),
LASTSIGNONDTTM VARCHAR2(22),
LASTUPDDTTM VARCHAR2(22),
LASTUPDOPRID VARCHAR2(30 BYTE),
PTALLOWSWITCHUSER INTEGER
organization external
( default directory my_dir
access parameters
( records delimited by newline
fields terminated by ','
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
location ('listofuser.txt')
reject limit unlimited;I used the following to retrieve info from the table:
SQL> select * from psoprdefn;
OPRID                                                          VERSION OPRDEFNDESC                    EMPLID      EMAILID                                                                OPRCLASS                       ROWSECCLASS                    OPERPSWD                                                       ENCRYPTED SYMBOLICID LANGUAGE_CD                               MULTILANG CURRENCY_CD LASTPSWDCHANGE                                ACCTLOCK PRCSPRFLCLS                    DEFAULTNAVHP                                              FAILEDLOGINS                                  EXPENT                                 OPRTYPE USERIDALIAS                                                            LASTSIGNONDTTM         LASTUPDDTTM            LASTUPDOPRID                                         PTALLOWSWITCHUSER
16436                                                              676 John John                      16436       john.john@gmalil                                                       POCLANYL                                                      OwciRHuJKpBBdJDyyZVo+K8MUqA=                                           1 FSTSD9     ENG                                               0             2013-01-28                                           0 POCLANYL                       POCLANYL                                                             0                                       0                                       0                                                                        2011-04-07 3:56:55 PM  2011-02-25 4:16:13 PM  63475                                                                0
SQL> Edited by: user503635 on Mar 1, 2013 6:15 PM

Similar Messages

  • Error while creating oracle external table

    I am trying to create an external table with the following syntax. WhenI have executed this statement in my server which running in my machine, it is working fine. Whine I try to run the same statement on different server, it is giving the below error. I have verified the grants on both the schemas, they are simillar.
    create table ext_ORGBASIC_CLIENT1(
    Serial_Number varchar2(1000),
    Add_Edit_Organization varchar2(1000),
    Parent_Organization varchar2(1000),
    Organization_Code varchar2(1000),
    Organization_Name varchar2(1000),
    Legal_Entity varchar2(1000),
    Active varchar2(1000),
    Require_Entity_Use__as_Matchin varchar2(1000),
    Pass_On_Tax_On_Tax_To_Customer varchar2(1000),
    Allow_Exemption_Without_Receiv varchar2(1000),
    Entiy_Use_Code_Association varchar2(1000),
    Tax_Calculation_Type_Code varchar2(1000),
    Transaction_Type_Code varchar2(1000),
    Transaction_Source_Code varchar2(1000),
    Taxware_Delivery_Terms_Code varchar2(1000),
    Taxware_Mode_of_Transport_Code varchar2(1000),
    Debit_Credit_Indicator varchar2(1000),
    Discount_Type_Code varchar2(1000),
    Place_of_Principal_Negotiation varchar2(1000),
    Quantity_Unit_of_Measure_Code varchar2(1000),
    Good_Service_Category_Code varchar2(1000),
    Tax_Rate_Of_Geo_Code_To_Be_Aut varchar2(1000))
    organization external
    ( type oracle_loader default directory EXT_TAB_DIR
    access parameters ( records delimited by newline characterset US7ASCII load
    when (serial_number != 'Number' and serial_number != '#')
    badfile 'EXT_TAB_DIR':'CLIENT1.bad'
    logfile 'EXT_TAB_DIR':'CLIENT1.log'
    fields terminated by ',' optionally enclosed by '"' lrtrim missing field values are null
    reject rows with all null fields )
    location ('C_CLIENT1_TXWR_FS1_TWEBULK_ORGBASIC_1_1_20091126102230_001_CSV.csv') )
    parallel reject limit unlimited
    while querieng from the table I am getting the below error
    select * from ext_orgbasic_client1;
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04001: error opening file CLIENT1.log
    ORA-06512: at "SYS.ORACLE_LOADER", line 19

    I try to run the same statement on different server, it is giving the below errorSame OS name & version?
    Same Oracle version to 4 decimal places?
    Same OS file permissions?
    Same OS pathnames?

  • Error in creating an external table referring to a XML file

    I've got an XML file and I've tried to create an external table referring to it in this way:
    CREATE TABLE mytable
        XML_DATA_COLUMN XMLType
      ORGANIZATION EXTERNAL
        TYPE ORACLE_LOADER DEFAULT DIRECTORY TEST_DIR
        ACCESS PARAMETERS ( records delimited BY newline
        (XML_DATA_COLUMN LOB) ) LOCATION ( 'myfile.xml' )
    where TEST_DIR is the directory where myfile.xml is stored,
    but I get this message:
    Error at Command Line:3 Column:4
    Error report:
    SQL Error: ORA-30656: column type not supported on external organized table
    30656.0000 -  "column type not supported on external organized table"
    *Cause:    Attempt to create an external organized table with a column
               of type LONG, LOB, BFILE, ADT, or VARRAY.
    *Action:   These column types are not supported, change the DDL.
    I want to have in the XML_DATA_COLUMN the content of myfile.xml so as to handle it by using extract and extractvalue functions.
    My oracle version is 10gR2 Express Edition
    Thanks!

    The examples in the following thread include an insert, but you could also use the select statement alone without the insert.
    http://www.orafaq.com/forum/mv/msg/172162/511897/0/#msg_511897

  • Create an external table based on an XML file

    Hi ,
    I am trying to create an external table based on XML file .Is it possible to do in OWB ?If Yes .Can someone please let me know the same .
    I was successfully able to create an external table based on a flat file which is of the extension *.txt.
    I was even able to load an XML file to a normal
    table .How do we do it to an external table?
    Thanks,
    Manjula

    Hello Manjula,
    Is it possible for you to spare sometime to list down the steps to be followed for creating External Table using flat file *.txt?
    I am trying to do it but not getting through it.
    Thanks in Advance,
    Ripesh

  • Create multiple external tables from same flat file ?

    using oracle 10g
    currently create many external tables like so..
    CREATE TABLE "XT_UNITS"
    "Q1_2012" VARCHAR2(25 BYTE),
    "Q2_2012" VARCHAR2(25 BYTE),
    "Q3_2012" VARCHAR2(25 BYTE),
    "Q4_2012" VARCHAR2(25 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "XE_FILES" ACCESS PARAMETERS ( records delimited BY newline
    skip 1 fields terminated BY ',' OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES
    ARE NULL ) LOCATION ( 'xtunits.csv' ))
    is there any way I can use 1 flat file (csv) to populate many external tables ?
    maybe by section ?

    Jay wrote:
    using oracle 10g
    currently create many external tables like so..
    CREATE TABLE "XT_UNITS"
    "Q1_2012" VARCHAR2(25 BYTE),
    "Q2_2012" VARCHAR2(25 BYTE),
    "Q3_2012" VARCHAR2(25 BYTE),
    "Q4_2012" VARCHAR2(25 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "XE_FILES" ACCESS PARAMETERS ( records delimited BY newline
    skip 1 fields terminated BY ',' OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES
    ARE NULL ) LOCATION ( 'xtunits.csv' ))
    is there any way I can use 1 flat file (csv) to populate many external tables ?
    maybe by section ?Not a logical question.
    An external table definition relates to one or more files.
    You could probably create multiple externable table definitions to access the same file(s), but you may end up with some operating system file locking issues if you're not careful, and to be honest why would you need to do that?

  • ORA-0092 error when trying to create an external table

    For some reason, I always received the following error whenever I attempt to create an
    External table.
    ORA-0092:missing or invalid option
    This is the code that I am using in SQL Plus:
    SQL> create table products (
    2 product_no number,
    3 description varchar2(100),
    4 price varchar2(20)
    5 )
    6 organization EXTERNAL (
    7 type oracle_loader
    8 default directory PRODUCT_DIR
    9 access parameters
    10 ( records delimited by newline
    11 badfile 'products.bad'
    12 logfile 'products.log'
    13 fields terminated by ','
    14 )
    15 location ('products.csv')
    16 )
    17 reject ('products.csv')
    18 )
    19 reject limit unlimited
    20 /
    organization EXTERNAL (
    ERROR at line 6:
    ORA-00922: missing or invalid option
    This is the statement that I used to create my directory:
    CREATE DIRECTORY PRODUCT_DIR AS 'd:\products';
    Does that directory have to be an actual physical directory in UNIX for this to work, or
    will it be looking for a products folder in the d drive of my Windows NT machine?

    The directory should exist on the server where Oracle is installed. Since clients can be more than one on various operating
    systems, It can not be a directory on the client (since that would not be valid for other clients or even the same user
    connecting from a different machine).
    Did you install the Standard Edition of Oracle or the Enterprise Edition of Oracle server on your machine?
    External Tables option may not be available on Standard Edition.
    I have Oracle9i Rel 2 installed on my server and the external tables works fine for me.

  • Can we create single External Table for multiple files?

    HI,
    Can we create External table for multiple files? Could anyone please explain it.
    Thanks and regards
    Gowtham Sen.

    to merge 16 files having same structureWell, if files have the same structure, as per the reading of the example from the following documentation, you can create one external table for all your files :
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#i1007480
    Nicolas.

  • Create a External Table in Oracle 10g:== ERROR: KUP-01005

    Hello.
    I have a problem working with external tables, hope someone can help me with this problem. Thanks.
    This is the code of the external table
    ========================
    CREATE TABLE SIAFI.RNP_IDS
    NUMERO_ID VARCHAR2(30 BYTE),
    PRIMER_NOMBRE VARCHAR2(300 BYTE),
    SEGUNDO_NOMBRE VARCHAR2(300 BYTE),
    APELLIDO_PATERNO VARCHAR2(300 BYTE),
    APELLIDO_MATERNO VARCHAR2(300 BYTE),
    DEPARTAMENTO VARCHAR2(300 BYTE),
    CORRELATIVO VARCHAR2(300 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY SEG_DIRECTORIO
    ACCESS PARAMETERS
    ( records delimited by NEWLINE
    badfile SEG_DIRECTORIO:'censo.bad'
    logfile SEG_DIRECTORIO:'censo.log'
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM
    REJECT ROWS WITH ALL NULL FIELDS
    (NUMERO_ID VARCHAR(30) NULLIF NUMERO_ID=BLANKS
    TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
    PRIMER_NOMBRE VARCHAR(300) NULLIF PRIMER_NOMBRE=BLANKS
    TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
    SEGUNDO_NOMBRE VARCHAR(300) NULLIF SEGUNDO_NOMBRE=BLANKS
    TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
    APELLIDO_PATERNO VARCHAR(300) NULLIF APELLIDO_PATERNO=BLANKS
    TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
    APELLIDO_MATERNO VARCHAR(300) NULLIF APELLIDO_MATERNO=BLANKS
    TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
    DEPARTAMENTO VARCHAR(300) NULLIF DEPARTAMENTO=BLANKS
    TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
    CORRELATIVO VARCHAR(300) NULLIF CORRELATIVO=BLANKS
    TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM,
    LOCATION (SEG_DIRECTORIO:'censo.txt')
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    When executing the stament select from RNP_IDS* it returns the following error message:
    ===========================================================
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "terminated": expecting one of: "and, comma, defaultif, not, nullif, or, )"
    KUP-01007: at line 6 column 56
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    ORA-06512: at line 1
    This is the example of the file I'm using:
    ==========================
    "0","DOUGLAS","AUGUSTO","ABBOTT","","1","3672097"
    "0101190600010","MARIA","URBANA","GOMEZ","URBINA","2","1949122"
    "0101190600076","ENRIQUETA","","GARCIA","","2","1162025"
    "0101190800106","LUCILA","","FLORES","","2","1658013"

    Hi
    Here we go...
    I reduced the 300 length of varcahr t o30 for testing purpose...
    SQL> CREATE TABLE RNP_IDS
    2 (
    3 NUMERO_ID VARCHAR2(30),
    4 PRIMER_NOMBRE VARCHAR2(30),
    5 SEGUNDO_NOMBRE VARCHAR2(30),
    6 APELLIDO_PATERNO VARCHAR2(30),
    7 APELLIDO_MATERNO VARCHAR2(30),
    8 DEPARTAMENTO VARCHAR2(30),
    9 CORRELATIVO VARCHAR2(30)
    10 )
    11 ORGANIZATION EXTERNAL
    12 ( TYPE ORACLE_LOADER
    13 DEFAULT DIRECTORY LOG
    14 ACCESS PARAMETERS
    15 ( records delimited by NEWLINE
    16 badfile LOG:'censo.bad'
    17 logfile LOg:'censo.log'
    18 FIELDS TERMINATED BY ','
    19 OPTIONALLY ENCLOSED BY '"' and '"'LDRTRIM
    20 REJECT ROWS WITH ALL NULL FIELDS
    21 (
    22 NUMERO_ID ,
    23 PRIMER_NOMBRE ,
    24 SEGUNDO_NOMBRE ,
    25 APELLIDO_PATERNO,
    26 APELLIDO_MATERNO ,
    27 DEPARTAMENTO,
    28 CORRELATIVO
    29 )
    30 )
    31 LOCATION ('sample1.txt')
    32 )
    33 REJECT LIMIT UNLIMITED
    34 NOPARALLEL
    35 NOMONITORING;
    Table created.
    SQL> desc rnp_ids
    Name Null? Type
    NUMERO_ID VARCHAR2(30)
    PRIMER_NOMBRE VARCHAR2(30)
    SEGUNDO_NOMBRE VARCHAR2(30)
    APELLIDO_PATERNO VARCHAR2(30)
    APELLIDO_MATERNO VARCHAR2(30)
    DEPARTAMENTO VARCHAR2(30)
    CORRELATIVO VARCHAR2(30)
    SQL> select numero_id from rnp_ids;
    NUMERO_ID
    0
    0101190600010
    0101190600076
    0101190800106
    - Pavan Kumar N

  • How do I create a 'external table' against clob

    Hi there,
    I have a need, where I will have multiple csv files, which I plan to load it to a temporary table using the 'external table' concept. My issue is that I will have many at the same time and I don't want to create too many tables.
    So is there a way I can create tables against clob (which will have ',' separated data.
    Basically instead of putting the ',' separated data in a file I want to keep it in CLOB.
    Let me know
    Thanks

    Yes I understand that. Problem is I will be having lot of data so I need good indexes to process it. That's why I am loading into a permanent temp table.
    The issue is I have to load multiple csv files at the same time. So either I have to have multiple external tables defined or I have to single thread.
    So I was wondering if there is a way to replace the csv file with CLOB, that will be very useful.
    Thanks

  • Error in creating the external table?

    SQL> create table oldemp (
    2 empno number(5),
    3 ename varchar2(20))
    4 organization external
    5 (type oracle_loader
    6 default directory emp_dir
    7 access parameters
    8 (records delimited by newline
    9 badfile 'bad_emp'
    10 logfile 'log_emp'
    11 fields terminated by ','
    12 (empno number(5),
    13 ename varchar2(20))
    14 LOCATION ('c:\EMP1.TXT'))
    15 PARALLEL 5
    16 REJECT LIMIT 200;
    PARALLEL 5
    ERROR at line 15:
    ORA-30648: missing LOCATION keyword
    SQL>

    error when inserting into the external table.
    Following is the error:
    SQL> create table oldemp (
    2 empno number(5),ename varchar2(20))
    3 organization external
    4 (type oracle_loader
    5 default directory emp_dir1
    6 access parameters
    7 (records delimited by newline
    8 badfile 'bad_emp'
    9 logfile 'log_emp'
    10 fields terminated by ','
    11 (empno number(5),
    12 ename varchar2(20)))
    13 LOCATION('EMP2.lst'))
    14 PARALLEL 5
    15 REJECT LIMIT 200;
    Table created.
    SQL> insert into oldemp values(100,'raj');
    insert into oldemp values(100,'raj')
    ERROR at line 1:
    ORA-30657: operation not supported on external organized table

  • Error in creating  External Table

    I am following the following procedure to create an external table,but somehow i am not getting success.Can anyone pls explain the error?
    CREATE OR REPLACE DIRECTORY TEST_DIR AS 'C:\TEST'
    Directory created.
    GRANT READ,WRITE ON DIRECTORY TEST_DIR TO PUBLIC
    Grant succeeded.
    CREATE TABLE external_table
    (empno     NUMBER(4),
    ename     VARCHAR2(10),
    job     VARCHAR2(9),
    mgr     NUMBER(4),
    hiredate DATE,
    sal     NUMBER(7, 2),
    comm     NUMBER(7, 2),
    deptno     NUMBER(2))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY TEST_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    BADFILE 'TEST_DIR':'emp.bad'
    LOGFILE 'TEST_DIR':'emp.log'
    FIELDS TERMINATED BY ',')
    LOCATION ('emp.csv'))
    Table created.
    The file emp.csv is located in TEST_DIR.
    SELECT * FROM EXTERNAL_TABLE
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: unable to open log file emp.log
    OS error The system cannot find the file specified.
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    -MS

    quote from the docs:
    "Note that READ or WRITE permission to a directory object means only that the Oracle database will read or write that file on your behalf. You are not given direct access to those files outside of the Oracle database unless you have the appropriate operating system privileges. Similarly, the Oracle database requires permission from the operating system to read and write files in the directories."
    http://www.di.unipi.it/~ghelli/didattica/bdl/B19306_01/server.102/b14215/et_concepts.htm

  • Creating external table - from a file with multiple field separators

    I need to create an external table from a flat file containing multiple field separators (",", ";" and "|").
    Is there any way to specifiy this in the CREATE TABLE (external) statement?
    FIELDS TERMINATED BY "," -- Somehow list more than just comma here?
    We receive the file from a vendor every week. I am trying to set up a process for some non-technical users, and I want to keep this process transparent to them and not require them to load the data into Oracle.
    I'd appreciate your help!

    scott@ORA92> CREATE OR REPLACE DIRECTORY my_dir AS 'c:\oracle'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE external_table
      2    (COL1 NUMBER,
      3       COL2 VARCHAR2(6),
      4       COL3 VARCHAR2(6),
      5       COL4 VARCHAR2(6),
      6       COL5 VARCHAR2(6))
      7  ORGANIZATION external
      8    (TYPE oracle_loader
      9       DEFAULT DIRECTORY my_dir
    10    ACCESS PARAMETERS
    11    (FIELDS
    12         (COL1 CHAR(255)
    13            TERMINATED BY "|",
    14          COL2 CHAR(255)
    15            TERMINATED BY ",",
    16          COL3 CHAR(255)
    17            TERMINATED BY ";",
    18          COL4 CHAR(255)
    19            TERMINATED BY ",",
    20          COL5 CHAR(255)
    21            TERMINATED BY ","))
    22    location ('flat_file.txt'))
    23  /
    Table created.
    scott@ORA92> select * from external_table
      2  /
          COL1 COL2   COL3   COL4   COL5
             1 Field1 Field2 Field3 Field4
             2 Field1 Field2 Field3 Field4
    scott@ORA92>

  • Create external table on a CSV file with a variable number of delimiters

    Hi experts,
    I was wondering what the best approach for the following issue.
    I'm trying to create an external table on a file which has in each record (on a new line 'RECORDS DELIMITED BY NEWLINE') a variabel number of delimiters. By example my delimiter is a comma , in the first record I have 100 comma's in the second only 60, the next 80 etc.etc.
    Is there a way to create a external table on this file?
    Thanks in advance.

    alter the source is no option, unfortunalty. But is suggested there would be a sensible workway to handle it. An to solve it I want to pivot i, but first I think I need to have the file in Oracle through a external table.
    Edited by: Jonathan Wisgerhof on Mar 31, 2009 12:21 PM

  • Trouble Creating View on External Table in Diff Schema

    I am unable to create a view in a different schema on an external table in a different schema, even when I am connected to my database as SYS as SYSDBA.
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    returns the error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I created a directory:
    CREATE DIRECTORY ER_ADMIN_DIR AS 'C:\ER_Init';
    Granted privs:
    grant read,write on directory ER_ADMIN_DIR to public;
    Created the external table EXT1 in a different schema WH1:
    CREATE TABLE WH1.EXT1 (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY SYS.ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('FILE1.TXT')
    REJECT LIMIT UNLIMITED;
    I can query from the table successfully connected as SYS:
    SQL> select count(*) from wh1.ext1;
    1008
    1 row selected.
    However when I try to create a view on that table connected as SYS:
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    I get the following error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I can connect over to the WH1 schema and create the view successfully, however due to a specific situation I need to be able to create the view from the SYS schema. I can create the view FORCE and it creates with compilation errors, however the view cannot be compiled successfully from SYS.
    Is there a known bug on creating views on external tables remotely?
    Thanks for any help!
    Tina

    I have been able to reproduce your error, using scott instead of sys, and resolve it, as demonstrated below. The combination that I found that worked consisted of having wh1 grant select on ext1 to scott explicitly and using set current_schema to wh1, so that ext1view did not require the wh1 qualifier.
    scott@ORA92> CREATE USER wh1 IDENTIFIED BY wh1
      2  /
    User created.
    scott@ORA92> GRANT CONNECT, RESOURCE TO wh1
      2  /
    Grant succeeded.
    scott@ORA92> CREATE OR REPLACE DIRECTORY er_admin_dir AS 'c:\er_init'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE wh1.ext1
      2    (table_name  VARCHAR2(100),
      3       column_name VARCHAR2(100))
      4  ORGANIZATION EXTERNAL
      5    (TYPE ORACLE_LOADER
      6       DEFAULT DIRECTORY er_admin_dir
      7       ACCESS PARAMETERS
      8         (RECORDS DELIMITED BY NEWLINE
      9          FIELDS TERMINATED BY ','
    10          MISSING FIELD VALUES ARE NULL)
    11       LOCATION ('file1.txt'))
    12  REJECT LIMIT UNLIMITED
    13  /
    Table created.
    scott@ORA92> CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
      2  /
    CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    scott@ORA92> CONNECT wh1/wh1
    Connected.
    scott@ORA92> @ LOGIN
    scott@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]2
    wh1@ORA92> GRANT SELECT ON ext1 TO scott
      2  /
    Grant succeeded.
    wh1@ORA92> CONNECT scott/tiger
    Connected.
    wh1@ORA92> @ LOGIN
    wh1@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]A92
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = wh1
      2  /
    Session altered.
    scott@ORA92> CREATE OR REPLACE VIEW ext1view AS SELECT * FROM wh1.ext1
      2  /
    View created.
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = scott
      2  /
    Session altered.
    scott@ORA92> SELECT * FROM wh1.ext1view
      2  /
    TABLE_NAME
    ---------------------------------------------------------COLUMN_NAME
    ---------------------------------------------------------tab1
    col1
    tab2
    col2
    scott@ORA92>

  • Error Creating View on External Table

    I create my oracle directory connected as SYS as SYSDBA and grant read,write to public:
    CREATE OR REPLACE DIRECTORY ER_ADMIN_DIR AS 'C:\win32app\ingr\ER\ER_Init\scripts';
    grant read,write on directory ER_ADMIN_DIR to public;
    I creat my external table from SYS to reside in another schema called DRTEST:
    CREATE TABLE DRTEST.SPEC_REQUIRED (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('atts_in_red.tx')
    REJECT LIMIT UNLIMITED ;
    I can select from the table and all is good at this point.
    However, I get an error when I try to create a view (in DRTEST from SYS) based on the external table.
    CREATE VIEW DRTEST.MYVIEW1 AS SELECT * FROM DRTEST.SPEC_REQUIRED;
    CREATE VIEW DRTEST.MYVIEW1 AS SELECT * FROM DRTEST.SPEC_REQUIRED
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    (note I'm still connected as SYS as SYSDBA here)
    I can create the view if I connect to DRTEST and run the exact same create view statement there. Is there something in Oracle that prevents me from doing this from the SYS account? I usually think of SYS as having the "Power of God to do all things".
    I have to create the external table and view on several schema's and I don't want the user to have to connect to each schema separately.
    Tina

    Tina,
    I think you are facing bug 2948123 (CREATE VIEW ON EXTERNAL TABLE ORA-6564). The workaround is to connect (in your case) as user DRTEST and then perform the CREATE VIEW statement (you tested this already). Or (according to the bug description) create the view under the SYS schema itself.

Maybe you are looking for

  • DVD player only shows video under Intel graphics

    I have a Macbook Pro 15", i7 2.66, and just noticed that Apple's DVD Player app will only show video under Intel graphics. When it's switched to the Nvidia 330M, all I get is a black screen (+ audio). Oddly, the VLC app works fine, so I'm (sort of) h

  • How Can I Save Picture as an .ico File Type (icon)?

    Hello. I have a picture that I want to use for an application's icon, and I was hoping that I could create the icon in PhotoShop Elements 6. I do not see any way to do this, however. That file-type option is not available in either "Save As" or "Expo

  • Photo duplication recognition software

    After moving around file structures, I lost all my photos in iPhoto 6. The great people at Apple were able to fish them out of the trash and cyber world, and for that I am so thankful...BUT It seems that every photo has been duplicated - that means I

  • Imageready cs2 to photoshop cs3 file conversion

    hello; when opening a Imageready file with rollovers in Photoshop CS3 you only get the "normal state" anybody knows of an app or plugin that would convert all old rollover states in a way PS CS3 understands? thanks Alex

  • Can i get the old version of iTunes back without deleting everytying?

    This new iTunes is the pits.  I want the old version back.  I deleted iTunes 11 and tried to reinstall an earlier version.  It gives me an error that my library cannot be recognized by an older version.  So...will i have to delete everything, librari