External table & SQL*loader

Hi everybody!
following is the script for control file and i want to create a similar script in External table ...
LOAD DATA
INFILE ''
INTO TABLE PAY_STG_OWN.STG_INTRA_ACTG_ENT
APPEND
FIELDS TERMINATED BY '~'
TRAILING NULLCOLS
ACTV_HIST_IND               CHAR(1)                    "TRIM(:ACTV_HIST_IND)"
,AUTH_STATUS               CHAR(1)                    "TRIM(:AUTH_STATUS)"     
,SUBSYS_PROD_COD          CHAR(10)               "TRIM(:SUBSYS_PROD_COD)"
,TRAN_AMT               INTEGER EXTERNAL(22)          "DECODE(TRIM(:TRAN_AMT),NULL,NULL,Fn_Deci_Ccy(:BR_COD,TO_NUMBER(fn_neg_pos(NVL(TRIM(:TRAN_AMT),'0'))),TRIM(:TRAN_CCY_COD),'SWIFT'))"
,LEGVEH                    CHAR(4)                    "TRIM(:LEGVEH)"
the last but one column calls the DECODE function followed by a user defined function Fn_Deci_Ccy() .
My question is ..
is it possible to call a user defined function while creating a external table.
An early reply is highly appreciable.
Thanks in advance
regards
Moloy

You cannot put a function directly in the statement that creates the external table. However, you can use the function in a statement that selects from the external table.

Similar Messages

  • Problem in external table & sql*loader

    hi all
    i want to transter data between flat file to oracle database through external table option and sql*loader Utility.
    1. how u make .dat file in external table.
    2. how u make .ctl file in sql*loader utility.
    if u know any good site plz. tell me.
    thanx
    Mohammadi52

    Hi,
    Use this link to search any Oracle documentation:
    http://tahiti.oracle.com/
    Also please have a look on the below link:
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/utility.htm
    Regards

  • Oracle 11g - External Table/SQL Developer Issue?

    Oracle 11g - External Table/SQL Developer Issue?
    ==============================
    I hope this is the right forum for this issue, if not let me, where to go.
    We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
    We are trying to use oracle external table to load text files in .csv format. Here is our data look like.
    ======================
    Date1,date2,Political party,Name, ROLE
    20-Jan-66,22-Nov-69,Democratic,"John ", MMM
    22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
    20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
    9-Aug-72,20-Jan-75,Republican,Henry,MMM
    ------ ALL NULL -- record
    20-Jan-80,20-Jan-89,Democratic,"Donald Smith",MMM
    ======================
    Our Expernal table structures is as follows
    CREATE TABLE P_LOAD
    DATE1 VARCHAR2(10),
    DATE2 VARCHAR2(10),
    POL_PRTY VARCHAR2(30),
    P_NAME VARCHAR2(30),
    P_ROLE VARCHAR2(5)
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY P_EXT_TAB_D
    ACCESS PARAMETERS (
    RECORDS DELIMITED by NEWLINE
    SKIP 1
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
    REJECT ROWS WITH ALL NULL FIELDS
    MISSING FIELD VALUES ARE NULL
    DATE1 CHAR (10) Terminated by "," ,
    DATE2 CHAR (10) Terminated by "," ,
    POL_PRTY CHAR (30) Terminated by "," ,
    P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
    P_ROLE CHAR (5) Terminated by ","
    LOCATION ('Input.dat')
    REJECT LIMIT UNLIMITED;
         It created successfully using SQL Developer
    Here is the issue.
    It is not loading the records, where fields are enclosed in '"' (Rec # 2,3,4,7)
    It is loading all NULL value record (Rec # 6)     
    *** If we remove the '"' from input data, it loads all records including all NULL records
    Log file has
    KUP-04021: field formatting error for field P_NAME
    KUP-04036: second enclosing delimiter not found
    KUP-04101: record 2 rejected in file ....
    Our questions
    Why did "REJECT ROWS WITH ALL NULL FIELDS" not working?
    Why did Terminated by "," OPTIONALLY ENCLOSED BY '"' not working?
    Any idea?
    Thanks in helping.

    I don't think this is a SQLDeveloper issue. You will get better answers in the Database - General or perhaps SQL and PL/SQL forums.

  • SQL*Loader or external table for load a MSG (email) file

    Hi there!
    I'm looking for a way to load an email in a Oracle DB.
    I mean, not all the email's body in a column, but to "parse" it in a multi column/table fashion.
    Is it possible to do with a sql*loader script or an external table?
    I think it is not possible, and that I must switch to XML DB.
    Any idea?
    Thanks,
    Antonio

    Hello,
    Why don't you just load the entire MSG (email) as clob into one email_body column or whatever column name you want to use.
    To load data upto 32k, you can use varchar2(32656) but its not a good idea to load clob in that manner because it's very inconsistent as length can
    vary resulting in string literal too long. So you have 2 choices now, first you have to use either procedure or anonymous block to load clob data.
    First Method -- I loaded alert.log successfully and you can imagine how big this file can be (5MB in my test case)
    CREATE OR REPLACE DIRECTORY DIR AS '/mydirectory/logs';
    DECLARE
       clob_data   CLOB;
       clob_file   BFILE;
    BEGIN
       INSERT INTO t1clob
       VALUES (EMPTY_CLOB ())
       RETURNING clob_text INTO clob_data;
       clob_file   := BFILENAME ('DIR', 'wwalert_dss.log');
       DBMS_LOB.fileopen (clob_file);
       DBMS_LOB.loadfromfile (clob_data,
                              clob_file,
                              DBMS_LOB.getlength (clob_file)
       DBMS_LOB.fileclose (clob_file);
       COMMIT;
    END;Second Method: Use of Sqlldr
    Example of controlfile
    LOAD DATA
    INFILE alert.log "STR '|\n'"
    REPLACE INTO  table t1clob
       clob_text char(30000000)
    )Hope this helps

  • Use of External tables to load XML data.

    Hi,
    I have used external table definitions to load various XML files to the database, usually splitting the XML into seperate records - 1 per major element tag, and using PL/SQL to parse out a primary key to store in a relational table with all of the XML relevant to that primary key value stored as an XMLTYPE coumn in a row of the table. This has worked fine for XML with a single major entity (element tag) .
    However, I now have an XML file that contains two "major" elements (both children of the root) that I would like to split out and store in seperate tables.
    The XML file is of the following basic format:-
    <drugs>
    <drug>drug 1...</drug>
    <drug>drug 2...</drug>
    <partners>
    <partner>partner 1</partner>
    <partner>partner 2</partner>
    </partners>
    </drugs>
    The problem is there are around 18000 elements of the first type, followed by several thousand of the 2nd type. I can create two seperate external tables - one for each element type, but how do I get the external table for the 2nd to ignore all the elements of the first type? My external table definition is :-
    CREATE TABLE DRUGBANK_OWNER.DRUGBANK_PARTNERS_XML_EXTERNAL
    DRUGBANK_XML CLOB
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY DRUGBANK_DIR
    ACCESS PARAMETERS
    ( records delimited by "</partner>" SKIP 100000
    characterset al32utf8
    badfile extlogs:'drugbank_partners_xml.bad'
    logfile extlogs:'drugbank_partners_xml.log'
    discardfile extlogs:'drugbank_partners_xml.dis'
    READSIZE 52428800
    fields
    drugbank_xml CHAR(50000000) terminated by '</partners>'
    LOCATION (DRUGBANK_DIR:'drugbank.xml')
    REJECT LIMIT UNLIMITED
    PARALLEL ( DEGREE 8 INSTANCES 1 )
    NOMONITORING;
    The problem is that before the first <partners> element the 1800 or so <drugs> elements cause a data cartrdige error:-
    ORA-29913: error in executing ODCIEXTTABLEFETCH callout
    ORA-29400: data cartridge error
    KUP-04020: found record longer than buffer size supported, 52428800
    This happens regardless of the value of the SKIP or the size of the drugbank_xml field.
    I have tried using an OR on the "records delimited by" access parameter, to 'delimit by "</partner>" OR "</drug>"', with the intention of filtering out the <drug> elements but this leads to a syntax error.
    Anyone ever tried anything similar and got it to work?
    Any other suggestions?
    Thanks,
    Sid.

    No, the content inside quotes is spanned across multiple lines....there are line breaks after every html tag.
    "What's the error message you are getting?"
    Iam not getting any error while selecting from external table , but I am getting tose rows in BAD file and log file has the following entries
    KUP-04021: field formatting error for field TKBS_DSCN
    KUP-04036: second enclosing delimiter not found
    Message was edited by:
    user627610

  • Privilege revoked on a table  - SQL*Loader-926: OCI error

    During recent maintainence activity , a table was exported & imported , deleted , truncated & dropped.After the activity an user lost its privilege on the table and a job related to this table has been failing with the below error
    SQL*Loader-926: OCI error while executing delete/truncate (due to REPLACE/TRUNCATE keyword) for table xyz.abc_def
    ORA-01031: insufficient privileges
    The privileges were granted on the table once again and since then the job has been successful , however we are unable to find the root cause which was responsible for the revoking of these privileges.
    Any suggestions and insight into this would be very helpful and much apprciated.

    Please read http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9003.htm#SQLRF01806
    >
    Dropping a table invalidates dependent objects and removes object privileges on the table. If you want to re-create the table, then you must regrant object privileges on the table, re-create the indexes, integrity constraints, and triggers for the table, and respecify its storage parameters
    >
    Edited by: P. Forstmann on 1 févr. 2011 13:44

  • External Tables (Oracle Loader)

    Hi While creating the external Table, i am getting error.
    ORA-12899: value too large for column PRC_REC_TYPE (actual: 2, maximum: 1)
    But while checking the CSV file, i found that prc_rec_type is having one 1 length value.
    -- Create table
    create table ET_PGIT_POL_RISK_COVER
    prc_pol_no VARCHAR2(60),
    prc_end_no_idx VARCHAR2(22),
    prc_sec_code VARCHAR2(12),
    prc_risk_id VARCHAR2(12),
    prc_smi_code VARCHAR2(12),
    prc_code VARCHAR2(12),
    prc_desc VARCHAR2(2000),
    prc_rate VARCHAR2(22),
    prc_rate_per VARCHAR2(22),
    prc_cvr_type VARCHAR2(1),
    prc_add_si_yn VARCHAR2(1),
    prc_si_curr_code VARCHAR2(12),
    prc_prem_curr_code VARCHAR2(12),
    prc_si_fc VARCHAR2(22),
    prc_si_lc_1 VARCHAR2(22),
    prc_si_lc_2 VARCHAR2(22),
    prc_si_lc_3 VARCHAR2(22),
    prc_prem_fc VARCHAR2(22),
    prc_prem_lc_1 VARCHAR2(22),
    prc_prem_lc_2 VARCHAR2(22),
    prc_prem_lc_3 VARCHAR2(22),
    prc_eff_fm_dt VARCHAR2(30),
    prc_eff_to_dt VARCHAR2(30),
    prc_brok_comm_appl_yn VARCHAR2(1),
    prc_no_clm_bonus_appl_yn VARCHAR2(1),
    prc_prof_comm_appl_yn VARCHAR2(1),
    prc_cr_uid VARCHAR2(12),
    prc_rate_eft VARCHAR2(12),
    prc_terrorism_yn VARCHAR2(1),
    prc_lvl VARCHAR2(12),
    prc_tot_si_fc VARCHAR2(22),
    prc_first_loss_perc VARCHAR2(22),
    prc_flxi_risk_cover_desc VARCHAR2(2000),
    prc_rec_type VARCHAR2(1)
    organization external
    type ORACLE_LOADER
    default directory MMI_DATA_MIG
    access parameters
    RECORDS DELIMITED BY NEWLINE BADFILE 'ET_PGIT_POL_RISK_COVER.Bad' LOGFILE 'ET_PGIT_POL_RISK_COVER.Log' FIELDS TERMINATED BY ',' MISSING FIELD VALUES ARE NULL REJECT ROWS WITH ALL NULL FIELDS
    location (MMI_DATA_MIG:'COVER_1.csv')
    reject limit UNLIMITED;
    Not able to upload the file here.

    CHANDAN,0,1001,1,,1004,TPPropertyDamage,2.00000,100.00000,C,0,001,001,10000.000,10000.000,10000.000,10000.000,200.000,200.000,200.000,200.000,14-Feb-13 11:10:39,13-Feb-14 23:59:00,1,0,0,MMI,,0,F,0.000,,,N
    CHANDAN,0,1001,1,,1005,RoadSideAssistance,1.50000,100.00000,C,0,001,001,15000.000,15000.000,15000.000,15000.000,225.000,225.000,225.000,225.000,14-Feb-13 11:10:39,13-Feb-14 23:59:00,1,0,0,MMI,,0,F,0.000,,,N
    There are Actually three rows in csv.Above 2 rows are not inserted into et table whereas last row is getting inserted into et table(Below one)
    CHANDAN,0,1001,1,,1099,SASRIA,0.25000,1.00000,C,0,001,001,12500.000,12500.000,12500.000,12500.000,0.250,0.250,0.250,0.250,14-Feb-13 11:10:39,13-Feb-14 23:59:00,0,0,0,MMI,,0,F,0.000,,,N

  • Oracle 11g - External Table Issue SQL - PL/SQL?

    Oracle 11g - External Table Issue?
    =====================
    I hope this is the right forum for this issue, if not let me, where to go.
    We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
    We are trying to use oracle external table to load text files in .csv format. Here is our data look like.
    ======================
    Date1,date2,Political party,Name, ROLE
    20-Jan-66,22-Nov-69,Democratic,"John ", MMM
    22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
    20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
    9-Aug-72,20-Jan-75,Republican,Henry,MMM
    ALL NULL -- record
    20-Jan-80,20-Jan-89,Democratic,"Donald Smith",MMM
    ======================
    Our Expernal table structures is as follows
    CREATE TABLE P_LOAD
    DATE1 VARCHAR2(10),
    DATE2 VARCHAR2(10),
    POL_PRTY VARCHAR2(30),
    P_NAME VARCHAR2(30),
    P_ROLE VARCHAR2(5)
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY P_EXT_TAB_D
    ACCESS PARAMETERS (
    RECORDS DELIMITED by NEWLINE
    SKIP 1
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
    REJECT ROWS WITH ALL NULL FIELDS
    MISSING FIELD VALUES ARE NULL
    DATE1 CHAR (10) Terminated by "," ,
    DATE2 CHAR (10) Terminated by "," ,
    POL_PRTY CHAR (30) Terminated by "," ,
    P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
    P_ROLE CHAR (5) Terminated by ","
    LOCATION ('Input.dat')
    REJECT LIMIT UNLIMITED;
    It created successfully using SQL Developer
    Here is the issue.
    It is not loading the records, where fields are enclosed in '"' (Rec # 2,3,4,7)
    It is loading all NULL value record (Rec # 6)
    *** If we remove the '"' from input data, it loads all records including all NULL records
    Log file has
    KUP-04021: field formatting error for field P_NAME
    KUP-04036: second enclosing delimiter not found
    KUP-04101: record 2 rejected in file ....
    Our questions
    Why did "REJECT ROWS WITH ALL NULL FIELDS" not working?
    Why did Terminated by "," OPTIONALLY ENCLOSED BY '"' not working?
    Any idea?
    Thanks in helping.
    Edited by: qwe16235 on Jun 11, 2011 11:31 AM

    I'm not sure, but maybe you should get rid of the redundancy that you have in your CREATE TABLE statement.
    This line covers all fields:
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    {code}
    So I would change the field list to:
    {code}
    DATE1 CHAR (10),
    DATE2 CHAR (10),
    POL_PRTY CHAR (30),
    P_NAME CHAR (30),
    P_ROLE CHAR (5)
    {code}
    It worked on my installation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • External table.How to load numbers (decimal and scientific notation format)

    Hi all, I need to load inside an external table records that contain 7 fields. The last field is called AMOUNT and it's represented in some records with the decimal format, in others records with the scientific notation format as, for example, below:
    CY001_STATU;2009;Jan;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    CY001_STATU;2009;Jan;11200100;'60800;CYZ900;41380,77
    The External table's script is the following:
    CREATE TABLE HYP_DATA
    COUNTRY VARCHAR2(50 BYTE),
    YEAR VARCHAR2(20 BYTE),
    PERIOD VARCHAR2(20 BYTE),
    ACCOUNT VARCHAR2(50 BYTE),
    DEPT VARCHAR2(20 BYTE),
    ACTIVITY_LOC VARCHAR2(20 BYTE),
    AMOUNT VARCHAR2(50 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY HYP_DATA_DIR
    ACCESS PARAMETERS
    ( RECORDS DELIMITED BY NEWLINE
    BADFILE 'HYP_BAD_DIR':'HYP_LOAD.bad'
    DISCARDFILE 'HYP_DISCARD_DIR':'HYP_LOAD.dsc'
    LOGFILE 'HYP_LOG_DIR':'HYP_LOAD.log'
    SKIP 0
    FIELDS TERMINATED BY ";"
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL FIELDS
    "COUNTRY" Char,
    "YEAR" Char,
    "PERIOD" Char,
    "ACCOUNT" Char,
    "DEPT" Char,
    "ACTIVITY_LOC" Char,
    "AMOUNT" Char
    LOCATION (HYP_DATA_DIR:'Total.txt')
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    If, for the field AMOUNT I use the datatype VARCHAR (as above), the table is loaded but I have some records rejected, and all these records contain the last field AMOUNT with the scientific notation as:
    CY001_STATU;2009;Jan;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    CY001_STATU;2009;Feb;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    CY001_STATU;2009;Mar;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    CY001_STATU;2009;Dec;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    All the others records with a decimal AMOUNT are loaded correctly.
    So, my problem is that I NEED to load all the records (with the decimal and the scientific notation format) together (without records rejected), but I don't know which datatype I have to use for the AMOUNT field....
    Anybody has any idea ???
    Any help would be appreciated
    Thanks in advance
    Alex

    @OP,
    What version of Oracle are you using?
    Just cut'n'paste of you script and example woked FINE for me.
    however my quation is... An external table will LOAD all data or none at all. How are you validating/concluding that...
    I have some records rejected, and all these records contain the last field AMOUNT with the scientific notation
    select * from v$version where rownum <2;
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    select * from mydata;
    CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Feb     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Jan     11200100     '60800     CYZ900     41380,77
    CY001_STATU     2009     Mar     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Dec     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Jan     11200100     '60800     CYZ900     41380,77MYDATA table script is...
    drop table mydata;
    CREATE TABLE mydata
    COUNTRY VARCHAR2(50 BYTE),
    YEAR VARCHAR2(20 BYTE),
    PERIOD VARCHAR2(20 BYTE),
    ACCOUNT VARCHAR2(50 BYTE),
    DEPT VARCHAR2(20 BYTE),
    ACTIVITY_LOC VARCHAR2(20 BYTE),
    AMOUNT VARCHAR2(50 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY IN_DIR
    ACCESS PARAMETERS
    ( RECORDS DELIMITED BY NEWLINE
    BADFILE 'IN_DIR':'HYP_LOAD.bad'
    DISCARDFILE 'IN_DIR':'HYP_LOAD.dsc'
    LOGFILE 'IN_DIR':'HYP_LOAD.log'
    SKIP 0
    FIELDS TERMINATED BY ";"
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL FIELDS
    "COUNTRY" Char,
    "YEAR" Char,
    "PERIOD" Char,
    "ACCOUNT" Char,
    "DEPT" Char,
    "ACTIVITY_LOC" Char,
    "AMOUNT" Char
    LOCATION (IN_DIR:'total.txt')
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;vr,
    Sudhakar B.

  • File loaded successfully by SQLldr but external table failed

    Hi ,
    When i tried to create an external table to load data from file it failed with the below error
    "KUP-04018: partial record at end of file",
    When i query on the external table for rows with rownum<2500 i can see the records being properly loaded but when i tried to fetch all records it throws the above error.
    But the same file when i loaded with sqlldr it loaded all the records successfully.
    Can you please let me know the reason for this?
    Regards

    Can you post us your SQLLDR control file, your external table definition, a sample of your data (preferably including the last lines of data which you believe are erroring) and also let us know your database version.

  • Load data from external table

    Hi ,
    How to load data from external table to transaction table using SQLLDR ?

    You use an external table to load the data it is described in the link to the manual I provided.
    Here is an example.
    Re: Using DML order to import a .xls file
    You would not be using SQLLDR though as external tables replace that functionality.

  • External tables in oracle 8i

    Hi,
    I am working in Oracle 8i. I need to use Oracle 8i External Table to load data in the database. But I am getting the following error
    ORA-00922: Missing or Invalid Option
    The snippet which I used is as follows:
    create table ext_table_csv (
    a NUMBER,
    n NUMBER,
    m NUMBER
    organization external
    type oracle_loader
    default directory swami
    access parameters (
    records delimited by newline
    fields terminated by ';'
    missing field values are null
    location ('sample.txt')
    PARALLEL
    reject limit 0
    The input file data is
    018307;20080421;123457
    018307;20080421;123457
    Please let me know how this can be done in Oracle 8i and I have to use Oracle Loader only.

    Its a new feature introduced in Oracle 9i.
    http://download.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90120/ch2_feat.htm#58871
    For 8i, SQL*Loader is the only option.

  • Oracle 11g - External Table/Remote File Issue?

    Oracle 11g - External Table/Remote File Issue?
    =============================
    I hope this is the right forum for this issue, if not let me, where to go.
    We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
    We are not allowed to put files on the CSV file system (Server A), where DB instance is running. We are able place CSV files on another server(Server B), where DB instance is not running.
    We are trying to use oracle external table to load text files in .CSV format.
    How do we create a Directory (Create Directory) on Server A DB to point to File system of Server B?
    Is it feasible?
    Any idea?
    Thanks in helping.

    The Solaris DBA should be able to mount the filesystem for you. Either that or you have to get creative transferring the file like this;
    http://www.linkedin.com/groups/Getting-creative-external-table-preprocessor-140609.S.50474382?qid=ba673ce4-c4bb-40c5-8367-52bd2a2dfc80&trk=group_search_item_list-0-b-ttl&goback=%2Egmp_140609
    Cheers
    David

  • Oracle 11g - External Table Issue?

    Oracle 11g - External Table Issue?
    =====================
    I hope this is the right forum for this issue, if not let me, where to go.
    We are using Oracle 11g (11.2.0.1.0) on (Platform : solaris[tm] oe (64-bit)), Sql Developer 3.0.04
    We are trying to use oracle external table to load text files in .csv format. Here is our data look like.
    ======================
    Date1,date2,Political party,Name, ROLE
    20-Jan-66,22-Nov-69,Democratic,"John ", MMM
    22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
    20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
    9-Aug-72,20-Jan-75,Republican,Henry,MMM
    ------ ALL NULL -- record
    20-Jan-80,20-Jan-89,Democratic,"Donald Smith",MMM
    ======================
    Our Expernal table structures is as follows
    CREATE TABLE P_LOAD
    DATE1 VARCHAR2(10),
    DATE2 VARCHAR2(10),
    POL_PRTY VARCHAR2(30),
    P_NAME VARCHAR2(30),
    P_ROLE VARCHAR2(5)
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY P_EXT_TAB_D
    ACCESS PARAMETERS (
    RECORDS DELIMITED by NEWLINE
    SKIP 1
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
    REJECT ROWS WITH ALL NULL FIELDS
    MISSING FIELD VALUES ARE NULL
    DATE1 CHAR (10) Terminated by "," ,
    DATE2 CHAR (10) Terminated by "," ,
    POL_PRTY CHAR (30) Terminated by "," ,
    P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
    P_ROLE CHAR (5) Terminated by ","
    LOCATION ('Input.dat')
    REJECT LIMIT UNLIMITED;
         It created successfully using SQL Developer
    Here is the issue.
    It is not loading the records, where fields are enclosed in '"' (Rec # 2,3,4,7)
    It is loading all NULL value record (Rec # 6)     
    *** If we remove the '"' from input data, it loads all records including all NULL records
    Log file has
    KUP-04021: field formatting error for field P_NAME
    KUP-04036: second enclosing delimiter not found
    KUP-04101: record 2 rejected in file ....
    Our questions
    Why did "REJECT ROWS WITH ALL NULL FIELDS" not working?
    Why did Terminated by "," OPTIONALLY ENCLOSED BY '"' not working?
    Any idea?
    Thanks in helping.
    Edited by: qwe16235 on Jun 10, 2011 2:16 PM

    The following worked for me:
    drop table p_load;
    CREATE TABLE P_LOAD
    DATE1 VARCHAR2(10),
    DATE2 VARCHAR2(10),
    POL_PRTY VARCHAR2(30),
    P_NAME VARCHAR2(30),
    P_ROLE VARCHAR2(5)
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY scott_def_dir1
    ACCESS PARAMETERS (
    RECORDS DELIMITED by NEWLINE
    badfile scott_def_dir2:'p_load_%a_%p.bad'
    logfile scott_def_dir2:'p_load_%a_%p.log'
    SKIP 1
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL FIELDS
    DATE1 CHAR (10) Terminated by "," ,
    DATE2 CHAR (10) Terminated by "," ,
    POL_PRTY CHAR (30) Terminated by "," ,
    P_NAME CHAR (30) Terminated by "," OPTIONALLY ENCLOSED BY '"' ,
    P_ROLE CHAR (5) Terminated by ","
    LOCATION ('Input.dat')
    REJECT LIMIT UNLIMITED;
    Note that I had to interchange the two lines:
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL FIELDS
    Just to get the access parameters to parse correctly.
    I added two empty lines, one in the middle and one at the end - both were rejected.
    In the log file, you will see the rejectiions:
    $ cat p_load_000_9219.log
    LOG file opened at 07/08/11 19:47:23
    Field Definitions for table P_LOAD
    Record format DELIMITED BY NEWLINE
    Data in file has same endianness as the platform
    Reject rows with all null fields
    Fields in Data Source:
    DATE1 CHAR (10)
    Terminated by ","
    Enclosed by """ and """
    Trim whitespace same as SQL Loader
    DATE2 CHAR (10)
    Terminated by ","
    Enclosed by """ and """
    Trim whitespace same as SQL Loader
    POL_PRTY CHAR (30)
    Terminated by ","
    Enclosed by """ and """
    Trim whitespace same as SQL Loader
    P_NAME CHAR (30)
    Terminated by ","
    Enclosed by """ and """
    Trim whitespace same as SQL Loader
    P_ROLE CHAR (5)
    Terminated by ","
    Enclosed by """ and """
    Trim whitespace same as SQL Loader
    KUP-04073: record ignored because all referenced fields are null for a record
    KUP-04073: record ignored because all referenced fields are null for a record
    Input Data:
    Date1,date2,Political party,Name, ROLE
    20-Jan-66,22-Nov-69,Democratic,"John ", MMM
    22-Nov-70,20-Jan-71,Democratic,"John Jr.",MMM
    20-Jan-68,9-Aug-70,Republican,"Rick Ford Sr.", MMM
    9-Aug-72,20-Jan-75,Republican,Henry,MMM
    4-Aug-70,20-Jan-75,Independent
    Result:
    SQL> select * from p_load;
    DATE1 DATE2 POL_PRTY P_NAME P_ROL
    20-Jan-66 22-Nov-69 Democratic John MMM
    22-Nov-70 20-Jan-71 Democratic John Jr. MMM
    20-Jan-68 9-Aug-70 Republican Rick Ford Sr. MMM
    9-Aug-72 20-Jan-75 Republican Henry MMM
    Regards,
    - Allen

  • External table with empty file

    Hi,
    My db version: Oracle 11g
    I have an empty csv file.
    I created a external table for the empty csv file.
    When I run:
    select count(*) from externaltblname;
    It returns 1.
    It should return 0 right.
    In the definition, I specified "SKIP 1"
    But still it returns 1.
    When I use this external table to load into a target table. It loads a single row with null values.
    How to fix this. Please advice.

    What works for me is the following (t_ext points to an empty csv):
    SQL> select count(field) from t_ext;
    COUNT(FIELD)
               1
    1 row selected.
    SQL> select ascii(field) from t_ext;
    ASCII(FIELD)
              13
    1 row selected.
    SQL> select count(replace(field, chr(13))) from t_ext;
    COUNT(REPLACE(FIELD,CHR(13)))
                                0
    1 row selected.

Maybe you are looking for

  • How to call view requests window from forms

    I have a custom form in which i am running a concurrent program using FND_REQUEST.SUBMIT_REQUEST. after I submit the request, I manually go to the view -> requests -> viewoutput to see the report output. Is there any function which can be used in the

  • External drives and disk space for iPhoto, iTunes...

    I'm ill and cannot spend much time sitting at a desk, so I have to a MacBook (aka, when real sick, I can work in a layZboy or in bed). So now I have the 17" MBP with 500G, and should upgrade the GHz to 8 as soon as prices drop. Here WAS my plan: I'd

  • 10-number-code to activate old CS2 Premium Version

    Got an payed CS2 Premium with official serial nummer. Want to install it on my old Macbook, it's impossible to get the 10-number-code to get it running. No server support, no phone support anymore. C2 download on adobe page is only the standard versi

  • How do i free up space in my icloud and make sure ALL of my photos and contacts are saved to the cloud?

    how do i free up space in my icloud and make sure ALL of my photos and contacts are saved to the cloud? because my app is running slow and i know I have things saved to my cloud and cant see them from the website

  • Security Update 2007-009 - Now no sound??

    I just installed the freshly released Security Update 2007-009 through software update. I now have no sound at all. System Preferences informs me that I have no Ouput or Input devices attached. System Profiler, however, tells me I do. I hear the chim