Create an external table to import csv to dynamic action

Hello

I'm trying to import data from a csv file into a table. The csv is located on the server and I try to do an external table to copy its contents to the master data table.
I can't even save the code, without this error:
PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
( begin case declare exit for goto if loop mod null pragma raise return select update
while with <an identifier> <a double-quoted delimited-identifier> <a bind variable>
<< continue close current delete fetch lock insert open rollback savepoint set sql execute
commit forall merge pipe purge
It works very well in the SQL Developer.
CREATE TABLE  "DATA_CSV" 
   (     "C1" VARCHAR2(255), 
     "C2" VARCHAR2(255), 
     "C3" VARCHAR2(255), 
     "C4" VARCHAR2(255), 
     "C5" VARCHAR2(255), 
     "C6" VARCHAR2(255), 
     "C7" VARCHAR2(255), 
     "C8" VARCHAR2(255), 
     "C9" VARCHAR2(255), 
     "C10" VARCHAR2(255), 
     "C11" VARCHAR2(255), 
     "C12" VARCHAR2(255), 
     "C13" VARCHAR2(255), 
     "C14" VARCHAR2(255), 
     "C15" VARCHAR2(255), 
     "C16" VARCHAR2(255), 
     "C17" VARCHAR2(255), 
     "C18" VARCHAR2(255), 
     "C19" VARCHAR2(255), 
     "C20" VARCHAR2(255)
   )
    ORGANIZATION EXTERNAL
    (
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY FTP_FOLDER
      ACCESS PARAMETERS (
        records delimited BY newline
        fields terminated BY ';'
        optionally enclosed BY '"'
        lrtrim
        missing field VALUES are NULL
      )
    LOCATION ('foo.csv')
    );
{code}

The server I work on, runs on Apex 4.2.2.

Thanks in advance, for your help
Skirnir                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

Tags: Database

Similar Questions

  • Creating the external Table - length fixed

    I was responsible for importing data in fixed length of a text file in an oracle table. To do this, I create an external Table. I'm finally at the point where the script works to create the table, but when I run a statement select for ' select * from external table ', I have received only a single line/record (the first line of the text file).

    This is what the script looks like:
    CREATE TABLE EXT_MD
    (
    AR_SID VARCHAR2 (12),
    AR_SSN VARCHAR2 (4).
    AR_LASTNAME VARCHAR2 (29),
    AR_FIRSTNAME VARCHAR2 (27),
    AR_RACE VARCHAR2 (1).
    DATE OF AR_DOB,
    NA_LASTNAME VARCHAR2 (29),
    NA_FIRSTNAME VARCHAR2 (27),
    NA_SEX VARCHAR2 (1).
    ID_FBI_ID VARCHAR2 (9).
    AR_ARR_DATE VARCHAR (26).
    AR_PRIMARY_CHARGE VARCHAR2 (35),
    DEM_STREET_NBR VARCHAR2 (5).
    DEM_STREET_NAM VARCHAR2 (10),
    DEM_STREET_SFX VARCHAR2 (2),
    DEM_STREET_DIR VARCHAR2 (2),
    DEM_CITY VARCHAR2 (10),
    DEM_STATE VARCHAR2 (2),
    DEM_ZIP VARCHAR2 (5).
    AR_TRACK_NUM VARCHAR2 (12),
    DEM_ORI VARCHAR2 (9)
    )
    EXTERNAL ORGANIZATION
    (TYPE ORACLE_LOADER
    THE DEFAULT DIRECTORY EXT_DIR
    ACCESS SETTINGS
    (
    RECORDS DELIMITED BY NEWLINE
    BADFILE EXT_DIR: 'ext_bag.bad'
    EXT_DIR LOG file: 'ext_good.log'
    FIELDS
    MISSING FIELD VALUES ARE NULL
    (
    AR_SID(1:12) CHAR (12),
    AR_SSN(13:16) CHAR (4),
    AR_LASTNAME(17:45) TANK (29),
    AR_FIRSTNAME(46:72) TANK (27),
    AR_RACE(73:73) CHAR (1),
    AR_DOB(74:83) CHAR(10) DATE_FORMAT DATE MASK "YYYY-MM-DD"
    NA_LASTNAME(84:112) TANK (29),
    NA_FIRSTNAME(113:139) TANK (27),
    NA_SEX(140:140) CHAR (1),
    ID_FBI_ID(141:149) CHAR(9),
    AR_ARR_DATE(150:175) TANK (26),
    AR_PRIMARY_CHARGE(176:210) CHAR (35),
    DEM_STREET_NBR(211:215) CHAR (5),
    DEM_STREET_NAM(216:225) CHAR(10),
    DEM_STREET_SFX(226:227) CHAR (2),
    DEM_STREET_DIR(228:229) CHAR (2),
    DEM_CITY(230:239) CHAR(10),
    DEM_STATE(240:241) CHAR (2),
    DEM_ZIP(242:246) CHAR (5),
    AR_TRACK_NUM(247:258) CHAR (12),
    DEM_ORI(259:267) TANK (9)
    )
    )
    LOCATION ("daily.txt")
    )
    REJECT LIMIT UNLIMITED;

    That's what part of the log file looks like:

    For table EXT_MD field definitions
    Record format DELIMITED BY newline
    Data in file have same "endianness" as platform
    Rows with all null fields are accepted

    Fields of the Data Source:

    AR_SID TANK (12)
    Position of the record (1: 12)
    Cut the whites of right
    AR_SSN CHAR (4)
    Position of the record (13: 16)
    Cut the whites of right
    etc (shows the rest of the columns with similar message) then at the end of the log file

    Transformations of columns
    ROWID

    Date table EXT_MD Cache statistics
    Maximum size: 1000
    Entries: 1
    Hits: 0
    Rate: 0

    Assistance or management will most certainly be appreciated. Thanks in advance.

    Published by: zephyr223 on March 25, 2013 10:47

    Hello
    Which characters do you have in your data file that define the "line break".

    Oracle documentation:

    If DELIMITED BY NEWLINE is specified, then the actual value used is platform-specific. On UNIX platforms, NEWLINE is assumed to be "\n". On Windows NT, NEWLINE is assumed to be "\r\n".
    

    you have these 'hidden' characters in your folder or are they something else?

    Kind regards
    Harry

  • create an external table based on local drive

    Hello world

    Is it possible to create an external table and that it points to a file on my local drive?

    It is perhaps a silly question. I'm sorry.

    Thank you

    Lydiea

    In addition to the response of William Robertson (which is correct), if you do not have a way to make the server access to your local disk, you can use sql loader on your local computer to load the data into an actual table.

  • Creating the external Table to alert log

    Hello

    I create an external table in oracle database 11g for the alert log file monitoring (to find the ORA errors), I used this statement to create an external table

    Create the directory TESTForAlertLog as 'E:\oracle\product\10.2.0\admin\db\bdump '.

    create table Alert_Log)
    Message varchar2 (30),
    Date of the day
    )
    (external) Organization
    type oracle_loader
    Default directory TESTForAlertLog
    (settings) access
    records delimited by newline
    fields ended by ',' possibly framed by "" "
    missing field values are null
    (
    "Message."
    'DAY' DATE 'DD MM YYYY ".
    )
    )
    location ("alert_db.log")
    )
    reject limit unlimited;

    Output is

    DAY OF MSG

    ORACLE V10.2.0.1.0 - Production vsnsta = 0
    ORACLE V10.2.0.1.0 - Production vsnsta = 0
    ORA-1109 marked during: ALTER DATABASE CLOSE NORMAL...
    ORA-00313: open failed for the members of the group log 1 of thread 1
    ORA-00312: thread 1 1 online journal: ' E:\ORACLE\PRODUCT\10.2.0\ORADATA\db\REDO01. JOURNAL"
    ORA-27041: could not open the file
    ORA-00313: open failed for the members of the Group of newspapers wire 2 1
    ORA-00312: wire 2 1 online journal: ' E:\ORACLE\PRODUCT\10.2.0\ORADATA\db\REDO02. JOURNAL"
    ORA-27041: could not open the file
    ORA-00313: open failed for the members of Group 3, Journal of thread 1
    ORA-00312: wire 3 1 online journal: ' E:\ORACLE\PRODUCT\10.2.0\ORADATA\db\REDO03. JOURNAL"
    ORA-27041: could not open the file
    ORACLE V10.2.0.1.0 - Production vsnsta = 0
    ORACLE V10.2.0.1.0 - Production vsnsta = 0

    But I need the eyes of output like this


    DAY OF MSG

    ORACLE V10.2.0.1.0 - Production vsnsta = 0 lun 22 dec 13:10:48 2008
    ORACLE V10.2.0.1.0 - Production vsnsta = 0 lun 22 dec 13:10:48 2008
    ORA-1109 marked during: ALTER DATABASE CLOSE NORMAL...
    ORA-00313: open failed for the members of the group log 1 of thread 1
    ORA-00312: thread 1 1 online journal: ' E:\ORACLE\PRODUCT\10.2.0\ORADATA\db\REDO01. JOURNAL"Mon dec 22 13:10:48 2008
    ORA-27041: could not open the file
    ORA-00313: open failed for the members of the Group of newspapers wire 2 1
    ORA-00312: wire 2 1 online journal: ' E:\ORACLE\PRODUCT\10.2.0\ORADATA\db\REDO02. JOURNAL"Mon dec 22 13:10:48 2008
    ORA-27041: could not open the file
    ORA-00313: open failed for the members of Group 3, Journal of thread 1
    ORA-00312: wire 3 1 online journal: ' E:\ORACLE\PRODUCT\10.2.0\ORADATA\db\REDO03. JOURNAL"Mon dec 22 13:10:48 2008
    ORA-27041: could not open the file
    ORACLE V10.2.0.1.0 - Production vsnsta = 0
    ORACLE V10.2.0.1.0 - Production vsnsta = 0

    I need the message and time of the message occurred

    No idea... is it possible to get this output...


    Thank U very much

    Concerning

    SHAN

    Read this - he explains how:
    http://www.singleQuery.com/2007/02/read-the-alert-log-with-SQL/

  • Create an external table fails

    I'm trying to map a trace file in an external table ' but I get the error message "missing the key word."
    set verify off
    
    create or replace directory 'TRACE_DIR' as '/db_home/oracle/product/diag/rdbms/test/dtms_t/trace';
    
    column id new_value os_user;
    SELECT sys_context('USERENV', 'OS_USER') id FROM DUAL;
    
    BEGIN
          EXECUTE IMMEDIATE 'alter session set tracefile_identifier = &os_user' ; 
    END;
    /
    
    column tracefile_loc new_value tracefile
    select SUBSTR(tracefile_loc,INSTR(tracefile_loc,'/',-1)+1) tracefile_loc
    from
     ( select value ||'/'||(select instance_name from v$instance) ||'_ora_'||
                  (select spid||case when traceid is not null then '_'||traceid else null end
                        from v$process where addr = (select paddr from v$session
                                                     where sid = (select sid from v$mystat
                                                                  where rownum = 1
                                                                 )
                                                    )
                  ) || '.trc' tracefile_loc
       from v$parameter where name = 'user_dump_dest'
     )
    /
    
    jbrock@ddtms_t> CREATE TABLE trace_ext
      2                     (line varchar2(80)
      3                     )
      4       ORGANIZATION EXTERNAL
      5       (
      6         TYPE ORACLE_LOADER
      7         DEFAULT DIRECTORY trace_dir
      8         ACCESS PARAMETERS
      9         (
     10           records delimited by newline
     11           missing field values are null
     12           ( line
     13           )
     14         )
     15         LOCATION (&&tracefile)
     16       )
     17       REJECT LIMIT UNLIMITED;
           LOCATION (ddtms_t_ora_9101_JBROCK.trc)
                                                *
         
    ERROR at line 15:
    ORA-00905: missing keyword

    Hello

    JimmyB wrote:

    ... jbrock@ddtms_t> CREATE TABLE trace_ext
    2                     (line varchar2(80)
    3                     )
    4       ORGANIZATION EXTERNAL
    5       (
    6         TYPE ORACLE_LOADER
    7         DEFAULT DIRECTORY trace_dir
    8         ACCESS PARAMETERS
    9         (
    10           records delimited by newline
    11           missing field values are null
    12           ( line
    13           )
    14         )
    15         LOCATION (&&tracefile)
    16       )
    17       REJECT LIMIT UNLIMITED;
    LOCATION (ddtms_t_ora_9101_JBROCK.trc)
    *
    
    ERROR at line 15:
    ORA-00905: missing keyword
    

    The location must not be single-quotes? For line 15, try

    LOCATION ('&&tracefile')
    
  • Helps to create an external table to a dashboard

    I am creating a table in an external file that will receive and organize partitions from Quiz.fla when you click on the button to submit the results.  I also want another fla file to reference the external table and pull 15 scores him and then view scores on a scrolling banner.  I want the banner to be able update dynamically (I guess it would accomplish the reloading of the banner fla every time it reaches the end of its cycle, with the first load of the image of the outer table on an onClipEvent action), how it will update while remaining open.  The main reason that I need two separate files for the quiz and the banner of the score is that they are displayed on two different monitors.  What would be the most effective way to solve this problem?  I know a little actionscript, but I don't have much experience with the call for data and functions from external fla or as files (table and function referring to the way in which the data will be organized inside the table will be in a file separate .as).

    I currently work in AS2, since I had almost no experience with AS3.

    Please mark this thread as answered, if it is closed.

  • Creating an external Table using Xml Dataset - how to include null values?

    The script below works fine, but I'm fails as soon as the xml file does not contain a column for a line, or has the value as "< ACTUAL_FLAG / >.

    Is there way I can show the missing values as null?

    With the help of "missing field is null values" does not work for me.

    Any help would be appreciated.


    < < < < < < < < < <
    / * Formatting on the 2010-05-24 14:53:01 (v5.136.908.31019 PS5) * /.
    DROP TABLE ENE_GL_SAP_TEMP;

    CREATE TABLE ENE_GL_SAP_TEMP
    (
    status VARCHAR2 (50).
    number of ledger_id (15),
    set_of_books_id NUMBER (15),
    accounting_date DATE,
    CURRENCY_CODE VARCHAR2 (15).
    Date_Created DATE,
    created_by NUMBER (15),
    actual_flag VARCHAR2 (1).
    user_je_category_name VARCHAR2 (25).
    user_je_source_name VARCHAR2 (25).
    Segment1 VARCHAR2 (25).
    Segment2 VARCHAR2 (25).
    segment3 VARCHAR2 (25).
    segment4 VARCHAR2 (25).
    segment5 VARCHAR2 (25).
    segment6 VARCHAR2 (25).
    segment7 VARCHAR2 (25).
    entered_dr NUMBER,
    entered_cr NUMBER,
    accounted_dr NUMBER,
    accounted_cr NUMBER,
    Reference1 VARCHAR2 (100)
    )
    EXTERNAL ORGANIZATION
    (
    TYPE ORACLE_LOADER
    THE DEFAULT DIRECTORY ENE_SOLAR_FTP_IN_DIR
    ACCESS SETTINGS
    (
    records delimited by ' < / GL_REC >.
    BadFile "temp.bad."
    logfile "temp.log.
    fields)

    filler TANK (2000) TERMINATED BY "< GL_REC >,"
    status (50) tank surrounded by '<>STATUS' and ' < / STATUS >. "
    ledger_id char (15), framed by '< LEDGER_ID >' and ' < / LEDGER_ID >, "
    set_of_books_id char (15), framed by '< SET_OF_BOOKS_ID >' and ' < / SET_OF_BOOKS_ID >, "
    accounting_date char (11), framed by '< ACCOUNTING_DATE >' and ' < / ACCOUNTING_DATE >, "
    Char (15) currency_code framed by '< CURRENCY_CODE >' and ' < / CURRENCY_CODE >. "
    tank (11) Date_Created framed by '< DATE_CREATED >' and ' < / DATE_CREATED > "date_format DATE mask MON/dd/yyyy". "
    created_by char (12), framed by '< CREATED_BY >' and ' < / CREATED_BY >. "
    actual_flag char (1) surrounded by '< ACTUAL_FLAG >' and ' < / ACTUAL_FLAG >, "
    user_je_category_name tank (25), framed by '< USER_JE_CATEGORY_NAME >' and ' < / USER_JE_CATEGORY_NAME >, "
    user_je_source_name tank (25), framed by '< USER_JE_SOURCE_NAME >' and ' < / USER_JE_SOURCE_NAME >, "
    tank (25) Segment1 framed by '< SEGMENT1 >' and ' < / SEGMENT1 >. "
    tank (25) Segment2 framed by '< SEGMENT2 >' and ' < / SEGMENT2 >. "
    tank (25) segment3 framed by '< SEGMENT3 >' and ' < / SEGMENT3 >. "
    segment4 tank (25), framed by '< SEGMENT4 >' and ' < / SEGMENT4 >, "
    tank (25) segment5 framed by '< SEGMENT5 >' and ' < / SEGMENT5 >, "
    segment6 tank (25), framed by '< SEGMENT6 >' and ' < / SEGMENT6 >, "
    segment7 tank (25), framed by '< SEGMENT7 >' and ' < / SEGMENT7 >. "
    entered_dr char (15), framed by '< ENTERED_DR >' and ' < / ENTERED_DR >, "
    entered_cr char (15), framed by '< ENTERED_CR >' and ' < / ENTERED_CR >, "
    accounted_dr char (15), framed by '< ACCOUNTED_DR >' and ' < / ACCOUNTED_DR >, "
    accounted_cr char (15), framed by '< ACCOUNTED_CR >' and ' < / ACCOUNTED_CR >, "
    tank (100) of reference1 framed by '< REFERENCE1 >' and ' < / REFERENCE1 >.



    )
    )
    LOCATION ("books2.xml")
    )
    PARALLEL
    REJECT LIMIT UNLIMITED;


    Select * from ENE_GL_SAP_TEMP;

    > > > > > > > > > > > > > > > > > >

    Hello

    It's funny, I never thought of parsing an XML through SQL * Loader before.

    Are you aware of the XML DB features? They are intended only for what you are doing here.

    Also, please look at function XMLTable. It allows you to directly map your XML file in columns and relational rows.

    For example, by giving an example of file "book.xml" like this:

    
    
     
      1
      2
      ABC
      DEF
     
     
      1
      3
      XYZ
      TTT
     
    
    

    Then, just do:

    SELECT *
    FROM XMLTable(
     '/GL_RECS/GL_REC'
     passing xmltype( bfilename('XML_DIR','book.xml'), nls_charset_id('CHAR_CS') )
     columns
      status varchar2(50) path 'STATUS',
      ledger_id varchar2(15) path 'LEDGER_ID',
      segment1 varchar2(25) path 'SEGMENT1',
      segment2 varchar2(25) path 'SEGMENT2'
    );
    
  • Create an external Table - KUP-04020

    11.2.0.1.0 64-bit

    ...  ORGANIZATION EXTERNAL
        (TYPE ORACLE_LOADER
         DEFAULT DIRECTORY ext_tab_dir
         ACCESS PARAMETERS
           (RECORDS DELIMITED BY NEWLINE
              FIELDS TERMINATED BY ',' ENCLOSED BY '"'
              (... {code}
    
    
    {code}ORA-29913: error in executing ODCIEXTTABLEFETCH callout
    ORA-29400: data cartridge error
    KUP-04020: found record longer than buffer size supported, 524288, in c:\ext_tables\nff.csv{code}
    
    When opening up the data for examination, the records are delimited with LF, and not CRLF.  
    Would this be picked up with delimiter NEWLINE, or should I use something else?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    To resolve this problem, change the delimiter CHARACTERSET and reviews

    ex:
    saves the delimiter character > record delimiter '\n '.

    Add in the parameters of access CHARACTERSET 'utf8 '.

  • creating an external table

    Hello

    I made an excel csv file, but some of the columns of the excel file are null, so I did type .dat
    and when I try: select *.
    from caen:

    I get this error:

    Error at startup on line 2 of the command:
    Select *.
    Caen
    Error report:
    SQL error: ORA-29913: error in executing ODCIEXTTABLEFETCH legend
    ORA-30653: reject limit reached
    29913 00000 - "error in the execution of %s legend".
    * Cause: The execution of the specified legend caused an error.
    * Action: Examine the error messages take appropriate measures.

    I also have a comma after each line FRO this .dat file.
    Can you help me to import this file?

    Thank you

    Some of your data values seem to have a comma in the data:

    Cultivarea cerealelor (exclusiv orez), plantelor leguminoase si aplantelor producatoare de seminte oleaginoase
    Cultivarea legumelor si a pepenilor, a radacinoaselor si tuberculilor
    Cultivarea fructelor arbustilor fructiferi, capsunilor, nuciferilorsi a altor pomi fructiferi
    Cultivarea condimentelor, plantelor aromatice, medicinale si aplantelor de uz farmaceutic
    

    I suggest that you change your data file if you can so that text fields are surrounded with double quotes.

  • External table with the empty file

    Hello

    My version of db: Oracle 11 g

    I have a csv file that is empty.

    I created an external table the empty csv file.

    When I run:

    Select count (*) in the externaltblname;

    It returns 1.

    It should return 0 to the right.

    In the definition, I specified "SKIP 1.

    But he always returns 1.

    When I use this external table to load into a table target. It loads a single row with null values.

    How to solve this problem. Please advice.

    What works for me is the following (t_ext points to a blank csv):

    SQL > select count (field) in the t_ext;

    COUNT (FIELD)

    ------------

    1

    1 selected line.

    SQL > select ascii (field) in the t_ext;

    ASCII (FIELD)

    ------------

    13

    1 selected line.

    SQL > select count (replace (field, chr (13))) of t_ext;

    COUNT (REPLACE (FIELD, CHR (13)))

    -----------------------------

    0

    1 selected line.

  • Create the external data with dates table

    I have a CSV file that looks a little like this:

    abcuser,12345,5/12/2012,5,250.55
    xyzuser, 67890, 5/1/2012,1,50
    ghjuser, 52523, 1 January 00

    When I create the external table, then question him, I get an error of date:

    CREATE TABLE xtern_ipay
    (
    username VARCHAR2 (50).
    acctNbr NUMBER 20 (0)
    datelastused DATE,
    number_rtxns NUMBER (12: 0).
    amtused NUMBER (12: 0)
    )
    external organization (TYPE oracle_loader DEFAULT directory "XTERN_DATA_DIR"
    (Settings) ACCESS
    records delimited BY newline completed fields BY ',')
    release location ("SubscriberStatistics.csv") limit) UNLIMITED;

    The error I see in the newspaper of rejection:
    For table XTERN_IPAY field definitions
    Record format DELIMITED BY newline
    Data in file have same "endianness" as platform
    Rows with all null fields are accepted

    Fields of the Data Source:

    USERID CHAR (255)
    Completed by «,»
    Trim whitespace same as SQL Loader
    ACCTNBR CHAR (255)
    Completed by «,»
    Trim whitespace same as SQL Loader
    DATELASTUSED CHAR (255)
    Completed by «,»
    Trim whitespace same as SQL Loader
    NUMBER_RTXNS CHAR (255)
    Completed by «,»
    Trim whitespace same as SQL Loader
    AMTUSED CHAR (255)
    Completed by «,»
    Trim whitespace same as SQL Loader
    column in treatment of DATELASTUSED error in the row 1 for the g:\externaltables\SubscriberStatistics.csv data file
    ORA-01858: a non-digit character was found here where was waiting for a digital
    column in treatment of DATELASTUSED error in line 2 to the g:\externaltables\SubscriberStatistics.csv data file
    ORA-01858: a non-digit character was found here where was waiting for a digital
    column in treatment of DATELASTUSED error on line 3 for the g:\externaltables\SubscriberStatistics.csv data file
    ORA-01858: a non-digit character was found here where was waiting for a digital


    Any ideas on that? I know I must tell oracle the date on the external file format, but I can't understand it.
  • Creating external Tables using the EXECUTE IMMEDIATE in PL/SQL

    Hi guys,.

    I am trying to create an external Table using the EXECUTE IMMEDIATE in a procedure and I managed to compile and no errors were generated. But when I try to run it from sql using the exec command I get the following error:

    ------------------------------------------------------------------------
    ERROR on line 5:
    ORA-00911: invalid character
    ORA-06512: at "GEO. TEST_DDL', line 4
    ORA-06512: at line 5

    -------------------------------------------------------------------------

    I tried to check the whole statement to create the external table, but I can't find where is the error. Surprisingly, if I simply run the command table create external on sqlplus it works, but not a procedure.

    If anyone can help with ideas or experience?

    Geoffrey Kossami

    The error means that there is an identifier somewhere that starts with a nonalphanumeric. This is a typical mistake of editing. A procedure compiles correctly is not of course because the underlying dynamic sql running is OK. Which of course only be resolved when you try to run it.

    There is certainly a problem with the text you provide to be run as a piece of dynamic sql code. You should try to watch it with dbms_output and run this code in sqlplus. But your problem is with the code you run as dynamic PL/SQL, it is not itself compilable.

    Jack

  • Pretreatment of an external table - table is empty at the end

    Hello

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    "CORE 11.2.0.1.0 Production."

    AMT for Solaris: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    Solaris 10 x 86

    I'm trying to create an external table that first pre-process a file and then the bed. The problem is that, in the end, the outer table is empty even if the read file is not empty.

    First, the table works gunzip on the 'employees.csv.gz' file located in/export/home/oracle/archives and then bed. The file employees.csv.gz exists in the specified location. This is the complete script:

    -This Directory keeps the archived files

    CREATE or REPLACE DIRECTORY arch_dir AS 'archives/export/home/oracle/archives";

    -This directory shows where the command gunzip

    CREATE or REPLACE the bin_dir AS DIRECTORY ' / usr/bin';

    CREATE TABLE emp_exadata

    (

    employee_id NUMBER (22, 0),

    first name VARCHAR2 (20).

    last_name VARCHAR2 (25).

    e-mail VARCHAR2 (25).

    Phone_Number VARCHAR2 (20).

    hire_date DATE,

    job_id VARCHAR2 (10),

    higher wages (22: 2),

    commission_pct NUMBER 22 (2)

    manager_id NUMBER (22, 0),

    department_id NUMBER (22, 0)

    )

    EXTERNAL ORGANIZATION

    (

    TYPE oracle_loader

    Arch_dir default DIRECTORY

    ACCESS SETTINGS

    (

    RECORDS delimited BY NEWLINE

    preprocessor bin_dir: "gunzip".

    end fields BY «»

    missing field VALUES are NULL

    (

    employe_id,

    first name,

    last_name,

    E-mail

    Phone_Number,

    hire_date CHAR date_format DATE mask "dd-mm-yyyy hh24:mi:ss."

    job_id,

    salary,

    commission_pct,

    manager_id,

    department_id

    )

    )

    LOCATION ("employees_exp.csv.gz")

    )

    REJECT LIMIT UNLIMITED;

    When I choose to emp_exadata the result set is empty!

    SELECT * FROM emp_exadata;

    no selected line

    When I look at the db server in the directory /export/home/oracle/archives I see no archived file employees_exp.csv. Here is the result of the first three lines:


    bash - $3.2-3 employees_exp.csv head

    198, Donald, Ollivier, DOCONNEL, 650.507.9833, 21/06/2007 00:00:00, SH_CLERK, 2600, 124, 50,.

    199, Douglas, grant, DGRANT, 650.507.9844, 2008-01-13 00:00:00, SH_CLERK, 2600, 124, 50,.

    200 Jennifer Whalen, JWHALEN 515.123.4444, 17/09/2003 00:00:00, AD_ASST, 4400, 101, 10.

    The end of the lines in the file line is LF (unix style). The encoding is in ANSI format.

    I tried to experiment around, but cannot view records when I select in the external table. Please help me to solve it.

    I also register the generated log file:

    LOG file opened at 01/06/15 16:40:11

    For table EMP_EXADATA field definitions

    Record format DELIMITED BY newline

    Data in file have same "endianness" as platform

    Rows with all null fields are accepted

    Fields of the Data Source:

    EMPLOYEE_ID CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    FIRST NAME CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    LAST_NAME CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    EMAIL CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    PHONE_NUMBER CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    HIRE_DATE TANK (19)

    Day DATE data type, date mask dd-mm-yyyy hh24:mi:ss

    Completed by «,»

    Trim whitespace same as SQL Loader

    JOB_ID CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    SALARY CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    COMMISSION_PCT CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    MANAGER_ID CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    DEPARTMENT_ID CHAR (255)

    Completed by «,»

    Trim whitespace same as SQL Loader

    You need to carefully examine the description of the PREPROCESSOR option in the chapter of the manual external Tables utility.

    The first point that applies to your question is that the preprocessor must write its data transformed to stdout. To do this with gunzip, you use the - c command line parameter. The second point that applies to your case, in view of the answer to the first point, is that you must write a script shell if your preprocessor requires command line settings.

    Kind regards

    Bob

  • Reg: question of external table-

    Hi Experts,

    I am trying to create and read from an external table, but it raises an error. Please notify.

    Scenario-

    I'm downloading a file of my APEX application that is stored in a BLOB field. Then, comes the following:

    DBMS_LOB.CREATETEMPORARY (v_clob, true);

    -/ / Convert BLOB on the CLOB type

    () DBMS_LOB.converttoclob

    v_clob, v_blob,

    DBMS_LOB. LOBMAXSIZE,

    v_dest_offset, v_src_offset,

    v_blob_csid, v_lang_context, g_msg

    );

    -/ / creating a csv file

    v_temp_filename: = 'apex_ ' | TO_CHAR (sysdate, 'yyyymmddhh24miss') |'. CSV';

    -/ / Put the csv file in the database directory 'APEX_DIR '.

    dbms_xslprocessor.clob2file (v_clob, 'APEX_DIR', v_temp_filename);

    -/ / creating an external table

    v_ext_table: = q'[create table (apex_temp_data_ext)

    C001 varchar2 (4000), c002 varchar2 (4000), c003 varchar2 (4000), c004 varchar2 (4000), c005 varchar2 (4000).

    C006 varchar2 (4000), c007 varchar2 (4000), c008 varchar2 (4000), c009 varchar2 (4000) c010 varchar2 (4000).

    C011 varchar2 (4000), c012 varchar2 (4000), c013 varchar2 (4000), c014 varchar2 (4000), c015 varchar2 (4000).

    C016 varchar2 (4000), c017 varchar2 (4000), c018 varchar2 (4000), c019 varchar2 (4000), c020 varchar2 (4000).

    C021 varchar2 (4000), c022 varchar2 (4000), c023 varchar2 (4000), c024 varchar2 (4000), see c025 varchar2 (4000).

    C026 varchar2 (4000), c027 varchar2 (4000), c028 varchar2 (4000), c029 varchar2 (4000), c030 varchar2 (4000).

    C031 varchar2 (4000), c032 varchar2 (4000), c033 varchar2 (4000), c034 varchar2 (4000), c035 varchar2 (4000).

    c037 varchar2 (4000), c038 varchar2 (4000), c039 varchar2 (4000), C036 varchar2 (4000), c040 varchar2 (4000).

    c042 varchar2 (4000), c043 varchar2 (4000), c044 varchar2 (4000), c041 varchar2 (4000), c045 varchar2 (4000).

    C046 varchar2 (4000), c047 varchar2 (4000), c048 varchar2 (4000), c049 varchar2 (4000), c050 varchar2 (4000)

    )

    (external) Organization

    type oracle_loader

    the default directory apex_dir

    (settings) access

    records delimited by newline

    fields completed by «,»

    surrounded of possibly ' "' and '"' NOTRIM

    missing field values are null

    (

    C001 varchar2 (4000), c002 varchar2 (4000), c003 varchar2 (4000), c004 varchar2 (4000), c005 varchar2 (4000).

    C006 varchar2 (4000), c007 varchar2 (4000), c008 varchar2 (4000), c009 varchar2 (4000) c010 varchar2 (4000).

    C011 varchar2 (4000), c012 varchar2 (4000), c013 varchar2 (4000), c014 varchar2 (4000), c015 varchar2 (4000).

    C016 varchar2 (4000), c017 varchar2 (4000), c018 varchar2 (4000), c019 varchar2 (4000), c020 varchar2 (4000).

    C021 varchar2 (4000), c022 varchar2 (4000), c023 varchar2 (4000), c024 varchar2 (4000), see c025 varchar2 (4000).

    C026 varchar2 (4000), c027 varchar2 (4000), c028 varchar2 (4000), c029 varchar2 (4000), c030 varchar2 (4000).

    C031 varchar2 (4000), c032 varchar2 (4000), c033 varchar2 (4000), c034 varchar2 (4000), c035 varchar2 (4000).

    c037 varchar2 (4000), c038 varchar2 (4000), c039 varchar2 (4000), C036 varchar2 (4000), c040 varchar2 (4000).

    c042 varchar2 (4000), c043 varchar2 (4000), c044 varchar2 (4000), c041 varchar2 (4000), c045 varchar2 (4000).

    C046 varchar2 (4000), c047 varchar2 (4000), c048 varchar2 (4000), c049 varchar2 (4000), c050 varchar2 (4000)

    )

    )

    location ('] ' |) v_temp_filename | " ')

    )

    3 parallel

    reject limit unlimited;] " ;



    immediately run v_ext_table;

    It gives me a generic mistake on the front-end server. But, when I take this external Table as well as the "v_temp_filename", that it is created, but when the SELECTION is fired triggers error:

    ORA-29913: error in executing ODCIEXTTABLEOPEN legend

    ORA-29400: data cartridge error

    KUP-00554: error occurred when parsing the access settings

    KUP-01005: syntax error: found 'distinctive sign': expected an a: "binary_double, types binary_float, comma, date, defaultif, char, decimal, double, float, integer, (, nullif, oracle_date, oracle_number, position, raw, recnum,), unsigned, varchar, varraw, varrawc, varcharc, zoned.

    KUP-01008: the bad ID was: varchar2

    KUP-01007: in column 15 of line 6

    Privilege is already provided - GRANT READ, WRITE on APEX_DIR to APEX_DEV;

    But you should check with DBA on the rwx for the generated 'v_temp_filename' permission.

    Pointers?

    Thank you and best regards,

    Nordine

    (on Oracle 11.2.0.3.0, Apex 4.2.5)

    Try this:

    . . .   E t c...

    -/ / creating an external table

    v_ext_table: = "CREATE TABLE Apex_Temp_Data_Ext

    (

    C001 VARCHAR2 (4000), C002 VARCHAR2 (4000), C003 VARCHAR2 (4000), C004 VARCHAR2 (4000), C005 VARCHAR2 (4000).

    C006 VARCHAR2 (4000), C007 VARCHAR2 (4000), C008 VARCHAR2 (4000), C009 VARCHAR2 (4000), C010 VARCHAR2 (4000).

    C011 VARCHAR2 (4000), C012 VARCHAR2 (4000), C013 VARCHAR2 (4000), C014 VARCHAR2 (4000), C015 VARCHAR2 (4000).

    C016 VARCHAR2 (4000), C017 VARCHAR2 (4000), C018 VARCHAR2 (4000), C019 VARCHAR2 (4000), C020 VARCHAR2 (4000).

    C021 VARCHAR2 (4000), C022 VARCHAR2 (4000), C023 VARCHAR2 (4000), C024 VARCHAR2 (4000), SEE C025 VARCHAR2 (4000).

    C026 VARCHAR2 (4000), C027 VARCHAR2 (4000), C028 VARCHAR2 (4000), C029 VARCHAR2 (4000), C030 VARCHAR2 (4000).

    C031 VARCHAR2 (4000), C032 VARCHAR2 (4000), C033 VARCHAR2 (4000), C034 VARCHAR2 (4000), C035 VARCHAR2 (4000).

    C036 VARCHAR2 (4000), C037 VARCHAR2 (4000), C038 VARCHAR2 (4000), C039 VARCHAR2 (4000), C040 VARCHAR2 (4000).

    C041 VARCHAR2 (4000), C042 VARCHAR2 (4000), C043 VARCHAR2 (4000), C044 VARCHAR2 (4000), C045 VARCHAR2 (4000).

    C046 VARCHAR2 (4000), C047 VARCHAR2 (4000), C048 VARCHAR2 (4000), C049 VARCHAR2 (4000), C050 VARCHAR2 (4000)

    )

    (EXTERNAL) ORGANIZATION

    TYPE Oracle_Loader

    The DEFAULT DIRECTORY Apex_Dir

    (SETTINGS) ACCESS

    RECORDS DELIMITED BY NEWLINE

    FIELDS TERMINATED BY ","

    OPTIONALLY SURROUNDED BY "" "AND" "" NOTRIM

    MISSING FIELD VALUES ARE NULL

    (

    C001 TANK (4000), C002 TANK (4000), C003 TANK (4000), C004 TANK (4000), CHAR C005 (4000),

    C006 TANK (4000), C007 TANK (4000), C008 TANK (4000), C009 TANK (4000), C010 TANK (4000).

    C011 TANK (4000), C012 TANK (4000), C013 TANK (4000), CHAR C014 (4000), C015 TANK (4000),

    C016 TANK (4000), C017 TANK (4000), CHAR C018 (4000), C019 TANK (4000), C020 TANK (4000),

    C021 TANK (4000), C022 TANK (4000), C023 TANK (4000), CHAR C024 (4000), SEE C025 TANK (4000),

    C026 TANK (4000), CHAR C027 (4000), C028 TANK (4000), C029 TANK (4000), C030 TANK (4000),

    C031 TANK (4000), C032 TANK (4000), C033 TANK (4000), C034 TANK (4000), C035 TANK (4000).

    C036 TANK (4000), C037 TANK (4000), C038 TANK (4000), C039 TANK (4000), C040 TANK (4000).

    C041 TANK (4000), C042 TANK (4000), C043 TANK (4000), C044 TANK (4000), C045 TANK (4000).

    C046 TANK (4000), C047 TANK (4000), C048 TANK (4000), C049 TANK (4000), C050 TANK (4000)

    )

    )

    LOCATION('''||) V_Temp_Filename | " ')

    )

    3 PARALLEL

    UNLIMITED RELEASE LIMIT ';

    . . .   E t c...

  • When to load the external table condition


    Hello

    Is my version of db: oracle 11g

    I have a 6 gig csv file.

    I divided it several 15 MB csv files.

    But only the first csv file has header (with column headers).

    I have to load each of these files into a target table.

    I created an external table with jump 1.

    But how can I substitute jumping 1 for other csv files.

    Is there a way I can do it in the external table definition.

    I can't merge the split csv files and run as one big file. So I don't hv this option. Please advice.

    You should be able to use the LOAD WHEN clause to exclude a line based on the contents of a field. Or the other

    WHEN LOAD 1 / 2! = "ID".

    or, if the bonds are quoted,

    WHEN LOAD 1:4! = « « ID » »

    or you can always add a list of fields to your specifications and the names of the fields in the reference LOAD WHEN the condition instead of using an absolute position.

    Don't know if you saw my comments on the use of the tail command before you replied, but if the break-up of the file is part of your project of automated process, and then deleting the header row could certainly be integrated into this process if your on a unix platform and using the split command to split the file.

    Kind regards

    Bob

Maybe you are looking for