Import using sql loader triming trailing white spaces

411885; JUICE 5-1; 990801;
123777; BDG 558-1; 100101;



I am importing data using sqlloader and problems with the load in the table space. The source of the data file is not safe how to provide "" in the beginning and the end of field 2. Is there an option on my end to remove the trailing spaces?

Hey

You can cut out using sqlloader in the control file columns listed all-in

(deptno,
dname "TRIM (:dname)",
loc "TRIM (:loc)")

Thank you
AJ

Tags: Database

Similar Questions

  • Error loading data using SQL loader

    I get an error message like "SQL * Loader - 350 combination illegal syntax of non-alphanumeriques characters error during loading of a file using SQL loader in RHEL." The command used to run SQL * Loader is:

    Sqlldr userid = < user name > / < password > control = data.ctl

    The control file is data.ctl:

    DOWNLOAD the data

    INFILE ' / home/oraprod/data.txt'

    Add in the table test

    {

    EmpID completed by «,»,

    fname completed by «,»,

    lname completed by «,»,

    treatment is completed with a white space

    }

    The data.txt file is:

    1, Kaushal, Hamad, 5000

    2, Chetan, Hamad, 1000

    Hopefully, my question is clear.

    Please get back with the answer to my query.

    Concerning

    Replace "{" by "("dans votre fichier de contrôle) "

    DOWNLOAD the data

    INFILE 'c:\data.txt.

    Add the emp_t table

    (

    EmpID completed by «,»,

    fname completed by «,»,

    lname completed by «,»,

    treatment is completed with a white space

    )

    C:\>sqlldr user/pwd@database control = c.ctl

    SQL * Loader: release 10.2.0.3.0 - Production on Wed Nov 13 10:10:24 2013

    Copyright (c) 1982, 2005, Oracle.  All rights reserved.

    Commit the point reached - the number of logical records 1

    Commit the point reached - the number of logical records 2

    SQL > select * from emp_t;

    EMPID, FNAME LNAME SALARY

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

    1 kone hamadi 5000

    2 Chetan Hamad 1000

    Best regards

    Mohamed Houri

  • SQL Loader - Skip empty, blank &amp; space lines

    Hi all

    I load data into MS-Excel using SQL Loader.

    Question:

    If all the blank lines or spaces lines are there, currently it's inclusion as an empty entry.

    Control file

    OPTIONS (SKIP = 1)

    load data

    in the temp_upload table

    Add

    fields ended by ',' optionally surrounded "" "

    TRAILING NULLCOLS

    (

    SPNAME "TRIM(:SPNAME)."

    GROUP OF USERS "TRIM(:USERGROUP)."

    IS_BUSINESS_CRITICAL "TRIM(:IS_BUSINESS_CRITICAL)"

    BUSINESS_CRITICAL_COMMENT "TRIM(:BUSINESS_CRITICAL_COMMENT)"

    BATCH_ID "(select batch_id de batch_tab) expression", "

    ID 'TEMP_UPLOAD_ID_SEQ. NEXTVAL '.

    )

    Help:


    Any solution to this problem? Please help me solve this problem.

    Ordinarily, SQL * Loader will reject, by default, all the rows where all columns are null.  However, when you assign the batch_id and id, these columns are null, the line is busy.  You can use SQL * Loader or external table to load the data into a staging table without these id, which will skip null lines, then insert into your target, adding the id, as shown below.

    Scott@orcl_11gR2 > host type test.dat

    Some title or column names

    spname1 usergroup1 ibc1, bcc1, batch1,

    spname3, usergroup3, ibc3, bcc3, batch3,

    Scott@orcl_11gR2 > type host test.ctl

    OPTIONS (SKIP = 1)

    load data

    in the staging table

    Add

    fields ended by ',' optionally surrounded "" "

    TRAILING NULLCOLS

    (

    SPNAME 'TRIM(:SPNAME) '.

    , GROUP OF USERS "TRIM(:USERGROUP)."

    , IS_BUSINESS_CRITICAL 'TRIM(:IS_BUSINESS_CRITICAL) '.

    , BUSINESS_CRITICAL_COMMENT 'TRIM(:BUSINESS_CRITICAL_COMMENT) '.

    )

    Scott@orcl_11gR2 > creating staging table

    2 (SPNAME varchar2 (7))

    3 usergroup varchar2 (10),

    4 IS_BUSINESS_CRITICAL varchar2 (4).

    5 BUSINESS_CRITICAL_COMMENT varchar2 (4))

    6.

    Table created.

    Scott@orcl_11gR2 > host sqlldr scott/tiger control = test.ctl data = test.dat log = test.log

    SQL * Loader: release 11.2.0.1.0 - Production Wed Jul 3 11:08:04 2013

    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

    Commit the point reached - the number of logical records 3

    Scott@orcl_11gR2 > select * from staging

    2.

    SPNAME USERGROUP IS_B BUSI

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

    spname1 usergroup1 ibc1 bcc1

    spname3 usergroup3 ibc3 bcc3

    2 selected lines.

    Scott@orcl_11gR2 > create table temp_upload

    2 (SPNAME varchar2 (7))

    3 usergroup varchar2 (10),

    4 IS_BUSINESS_CRITICAL varchar2 (4).

    5 BUSINESS_CRITICAL_COMMENT varchar2 (4).

    6 number BATCH_ID,

    Number 7)

    8.

    Table created.

    Scott@orcl_11gR2 > create table batch_tab as select 10 double batch_id

    2.

    Table created.

    Scott@orcl_11gR2 > create sequence temp_upload_id_seq

    2.

    Order of creation.

    Scott@orcl_11gR2 > insert into temp_upload

    2. Select usergroup, spname, is_business_critical, business_critical_comment,

    3 (selection batch_id batch_tab),

    4 temp_upload_id_seq.nextval

    5 staging

    6.

    2 rows created.

    Scott@orcl_11gR2 > select * from temp_upload

    2.

    SPNAME USERGROUP IS_B BUSI BATCH_ID ID

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

    spname1 usergroup1 ibc1 bcc1 10 1

    spname3 usergroup3 ibc3 10 2 bcc3

    2 selected lines.

  • Question to load data using sql loader in staging table, and then in the main tables!

    Hello

    I'm trying to load data into our main database table using SQL LOADER. data will be provided in separate pipes csv files.

    I have develop a shell script to load the data and it works fine except one thing.

    Here are the details of a data to re-create the problem.

    Staging of the structure of the table in which data will be filled using sql loader

    create table stg_cmts_data (cmts_token varchar2 (30), CMTS_IP varchar2 (20));

    create table stg_link_data (dhcp_token varchar2 (30), cmts_to_add varchar2 (200));

    create table stg_dhcp_data (dhcp_token varchar2 (30), DHCP_IP varchar2 (20));

    DATA in the csv file-

    for stg_cmts_data-

    cmts_map_03092015_1.csv

    WNLB-CMTS-01-1. 10.15.0.1

    WNLB-CMTS-02-2 | 10.15.16.1

    WNLB-CMTS-03-3. 10.15.48.1

    WNLB-CMTS-04-4. 10.15.80.1

    WNLB-CMTS-05-5. 10.15.96.1

    for stg_dhcp_data-

    dhcp_map_03092015_1.csv

    DHCP-1-1-1. 10.25.23.10, 25.26.14.01

    DHCP-1-1-2. 56.25.111.25, 100.25.2.01

    DHCP-1-1-3. 25.255.3.01, 89.20.147.258

    DHCP-1-1-4. 10.25.26.36, 200.32.58.69

    DHCP-1-1-5 | 80.25.47.369, 60.258.14.10

    for stg_link_data

    cmts_dhcp_link_map_0309151623_1.csv

    DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2

    DHCP-1-1-2. WNLB-CMTS-03-3,WNLB-CMTS-04-4,WNLB-CMTS-05-5

    DHCP-1-1-3. WNLB-CMTS-01-1

    DHCP-1-1-4. WNLB-CMTS-05-8,WNLB-CMTS-05-6,WNLB-CMTS-05-0,WNLB-CMTS-03-3

    DHCP-1-1-5 | WNLB-CMTS-02-2,WNLB-CMTS-04-4,WNLB-CMTS-05-7

    WNLB-DHCP-1-13 | WNLB-CMTS-02-2

    Now, after loading these data in the staging of table I have to fill the main database table

    create table subntwk (subntwk_nm varchar2 (20), subntwk_ip varchar2 (30));

    create table link (link_nm varchar2 (50));

    SQL scripts that I created to load data is like.

    coil load_cmts.log

    Set serveroutput on

    DECLARE

    CURSOR c_stg_cmts IS SELECT *.

    OF stg_cmts_data;

    TYPE t_stg_cmts IS TABLE OF stg_cmts_data % ROWTYPE INDEX BY pls_integer;

    l_stg_cmts t_stg_cmts;

    l_cmts_cnt NUMBER;

    l_cnt NUMBER;

    NUMBER of l_cnt_1;

    BEGIN

    OPEN c_stg_cmts.

    Get the c_stg_cmts COLLECT in BULK IN l_stg_cmts;

    BECAUSE me IN l_stg_cmts. FIRST... l_stg_cmts. LAST

    LOOP

    SELECT COUNT (1)

    IN l_cmts_cnt

    OF subntwk

    WHERE subntwk_nm = l_stg_cmts (i) .cmts_token;

    IF l_cmts_cnt < 1 THEN

    INSERT

    IN SUBNTWK

    (

    subntwk_nm

    )

    VALUES

    (

    l_stg_cmts (i) .cmts_token

    );

    DBMS_OUTPUT. Put_line ("token has been added: ' |") l_stg_cmts (i) .cmts_token);

    ON THE OTHER

    DBMS_OUTPUT. Put_line ("token is already present'");

    END IF;

    WHEN l_stg_cmts EXIT. COUNT = 0;

    END LOOP;

    commit;

    EXCEPTION

    WHILE OTHERS THEN

    Dbms_output.put_line ('ERROR' |) SQLERRM);

    END;

    /

    output

    for dhcp


    coil load_dhcp.log

    Set serveroutput on

    DECLARE

    CURSOR c_stg_dhcp IS SELECT *.

    OF stg_dhcp_data;

    TYPE t_stg_dhcp IS TABLE OF stg_dhcp_data % ROWTYPE INDEX BY pls_integer;

    l_stg_dhcp t_stg_dhcp;

    l_dhcp_cnt NUMBER;

    l_cnt NUMBER;

    NUMBER of l_cnt_1;

    BEGIN

    OPEN c_stg_dhcp.

    Get the c_stg_dhcp COLLECT in BULK IN l_stg_dhcp;

    BECAUSE me IN l_stg_dhcp. FIRST... l_stg_dhcp. LAST

    LOOP

    SELECT COUNT (1)

    IN l_dhcp_cnt

    OF subntwk

    WHERE subntwk_nm = l_stg_dhcp (i) .dhcp_token;

    IF l_dhcp_cnt < 1 THEN

    INSERT

    IN SUBNTWK

    (

    subntwk_nm

    )

    VALUES

    (

    l_stg_dhcp (i) .dhcp_token

    );

    DBMS_OUTPUT. Put_line ("token has been added: ' |") l_stg_dhcp (i) .dhcp_token);

    ON THE OTHER

    DBMS_OUTPUT. Put_line ("token is already present'");

    END IF;

    WHEN l_stg_dhcp EXIT. COUNT = 0;

    END LOOP;

    commit;

    EXCEPTION

    WHILE OTHERS THEN

    Dbms_output.put_line ('ERROR' |) SQLERRM);

    END;

    /

    output

    for link -.

    coil load_link.log

    Set serveroutput on

    DECLARE

    l_cmts_1 VARCHAR2 (4000 CHAR);

    l_cmts_add VARCHAR2 (200 CHAR);

    l_dhcp_cnt NUMBER;

    l_cmts_cnt NUMBER;

    l_link_cnt NUMBER;

    l_add_link_nm VARCHAR2 (200 CHAR);

    BEGIN

    FOR (IN) r

    SELECT dhcp_token, cmts_to_add | ',' cmts_add

    OF stg_link_data

    )

    LOOP

    l_cmts_1: = r.cmts_add;

    l_cmts_add: = TRIM (SUBSTR (l_cmts_1, 1, INSTR (l_cmts_1, ',') - 1));

    SELECT COUNT (1)

    IN l_dhcp_cnt

    OF subntwk

    WHERE subntwk_nm = r.dhcp_token;

    IF l_dhcp_cnt = 0 THEN

    DBMS_OUTPUT. Put_line ("device not found: ' |") r.dhcp_token);

    ON THE OTHER

    While l_cmts_add IS NOT NULL

    LOOP

    l_add_link_nm: = r.dhcp_token |' _TO_' | l_cmts_add;

    SELECT COUNT (1)

    IN l_cmts_cnt

    OF subntwk

    WHERE subntwk_nm = TRIM (l_cmts_add);

    SELECT COUNT (1)

    IN l_link_cnt

    LINK

    WHERE link_nm = l_add_link_nm;

    IF l_cmts_cnt > 0 AND l_link_cnt = 0 THEN

    INSERT INTO link (link_nm)

    VALUES (l_add_link_nm);

    DBMS_OUTPUT. Put_line (l_add_link_nm |) » '||' Has been added. ") ;

    ELSIF l_link_cnt > 0 THEN

    DBMS_OUTPUT. Put_line (' link is already present: ' | l_add_link_nm);

    ELSIF l_cmts_cnt = 0 then

    DBMS_OUTPUT. Put_line (' no. CMTS FOUND for device to create the link: ' | l_cmts_add);

    END IF;

    l_cmts_1: = TRIM (SUBSTR (l_cmts_1, INSTR (l_cmts_1, ',') + 1));

    l_cmts_add: = TRIM (SUBSTR (l_cmts_1, 1, INSTR (l_cmts_1, ',') - 1));

    END LOOP;

    END IF;

    END LOOP;

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    Dbms_output.put_line ('ERROR' |) SQLERRM);

    END;

    /

    output

    control files -

    DOWNLOAD THE DATA

    INFILE 'cmts_data.csv '.

    ADD

    IN THE STG_CMTS_DATA TABLE

    When (cmts_token! = ") AND (cmts_token! = 'NULL') AND (cmts_token! = 'null')

    and (cmts_ip! = ") AND (cmts_ip! = 'NULL') AND (cmts_ip! = 'null')

    FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    ('RTRIM (LTRIM (:cmts_token))' cmts_token,

    cmts_ip ' RTRIM (LTRIM(:cmts_ip)) ")". "

    for dhcp.


    DOWNLOAD THE DATA

    INFILE 'dhcp_data.csv '.

    ADD

    IN THE STG_DHCP_DATA TABLE

    When (dhcp_token! = ") AND (dhcp_token! = 'NULL') AND (dhcp_token! = 'null')

    and (dhcp_ip! = ") AND (dhcp_ip! = 'NULL') AND (dhcp_ip! = 'null')

    FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    ('RTRIM (LTRIM (:dhcp_token))' dhcp_token,

    dhcp_ip ' RTRIM (LTRIM(:dhcp_ip)) ")". "

    for link -.

    DOWNLOAD THE DATA

    INFILE 'link_data.csv '.

    ADD

    IN THE STG_LINK_DATA TABLE

    When (dhcp_token! = ") AND (dhcp_token! = 'NULL') AND (dhcp_token! = 'null')

    and (cmts_to_add! = ") AND (cmts_to_add! = 'NULL') AND (cmts_to_add! = 'null')

    FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    ('RTRIM (LTRIM (:dhcp_token))' dhcp_token,

    cmts_to_add TANK (4000) RTRIM (LTRIM(:cmts_to_add)) ")" ""

    SHELL SCRIPT-

    If [!-d / log]

    then

    Mkdir log

    FI

    If [!-d / finished]

    then

    mkdir makes

    FI

    If [!-d / bad]

    then

    bad mkdir

    FI

    nohup time sqlldr username/password@SID CONTROL = load_cmts_data.ctl LOG = log/ldr_cmts_data.log = log/ldr_cmts_data.bad DISCARD log/ldr_cmts_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &

    nohup time username/password@SID @load_cmts.sql

    nohup time sqlldr username/password@SID CONTROL = load_dhcp_data.ctl LOG = log/ldr_dhcp_data.log = log/ldr_dhcp_data.bad DISCARD log/ldr_dhcp_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &

    time nohup sqlplus username/password@SID @load_dhcp.sql

    nohup time sqlldr username/password@SID CONTROL = load_link_data.ctl LOG = log/ldr_link_data.log = log/ldr_link_data.bad DISCARD log/ldr_link_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &

    time nohup sqlplus username/password@SID @load_link.sql

    MV *.log. / log

    If the problem I encounter is here for loading data in the link table that I check if DHCP is present in the subntwk table, then continue to another mistake of the newspaper. If CMTS then left create link to another error in the newspaper.

    Now that we can here multiple CMTS are associated with unique DHCP.

    So here in the table links to create the link, but for the last iteration of the loop, where I get separated by commas separate CMTS table stg_link_data it gives me log as not found CMTS.

    for example

    DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2

    Here, I guess to link the dhcp-1-1-1 with balancing-CMTS-01-1 and wnlb-CMTS-02-2

    Theses all the data present in the subntwk table, but still it gives me journal wnlb-CMTS-02-2 could not be FOUND, but we have already loaded into the subntwk table.

    same thing is happening with all the CMTS table stg_link_data who are in the last (I think here you got what I'm trying to explain).

    But when I run the SQL scripts in the SQL Developer separately then it inserts all valid links in the table of links.

    Here, she should create 9 lines in the table of links, whereas now he creates only 5 rows.

    I use COMMIT in my script also but it only does not help me.

    Run these scripts in your machine let me know if you also get the same behavior I get.

    and please give me a solution I tried many thing from yesterday, but it's always the same.

    It is the table of link log

    link is already present: dhcp-1-1-1_TO_wnlb-cmts-01-1

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-02-2

    link is already present: dhcp-1-1-2_TO_wnlb-cmts-03-3
    link is already present: dhcp-1-1-2_TO_wnlb-cmts-04-4

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-5

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-01-1

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-8
    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-6
    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-0

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-03-3

    link is already present: dhcp-1-1-5_TO_wnlb-cmts-02-2
    link is already present: dhcp-1-1-5_TO_wnlb-cmts-04-4

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-7

    Device not found: wnlb-dhcp-1-13

    IF NEED MORE INFORMATION PLEASE LET ME KNOW

    Thank you

    I felt later in the night that during the loading in the staging table using UNIX machine he created the new line for each line. That is why the last CMTS is not found, for this I use the UNIX 2 BACK conversion and it starts to work perfectly.

    It was the dos2unix error!

    Thank you all for your interest and I may learn new things, as I have almost 10 months of experience in (PLSQL, SQL)

  • Importing data using SQL loader.

    Hi all

    I'm trying to import data from a txt file. I have created a CTL and the bat which I include below.

    CTL file
    LOAD DATA
    TRUNCATE
    INTO TABLE danint.VOIP
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    ( destination             INTEGER EXTERNAL
      destination_group       INTEGER EXTERNAL
      country                 CHAR,
      description             CHAR,
      off_peak_period         INTEGER EXTERNAL
      first_interval          INTEGER EXTERNAL
      next_interval           FLOAT EXTERNAL,
      first_price             DECIMAL EXTERNAL
      next_price              DECIMAL EXTERNAL
      off_peak_first_interval DECIMAL EXTERNAL
      off_peak_next_interval  DECIMAL EXTERNAL
      off_peak_first_price    DECIMAL EXTERNAL
      payback_rate            DECIMAL EXTERNAL
      forbidden               INTEGER EXTERNAL
      hidden                  INTEGER EXTERNAL
      discontinued            INTEGER EXTERNAL
      effective_from          DATE 'DD/MM/YYYY',
      formula                 INTEGER EXTERNAL
      report_date             DATE 'DD/MM/YYYY'
    )
    DATA
    995,,GEORGIA,Proper,,1,1,0.0795,0.0795,1,1,0.0795,0.0795
    995122,,GEORGIA,Sukhumi proper,,1,1,0.0795,0.0795,1,1,0.0795,0.0795
    9953,,GEORGIA,proper other,,1,1,0.0795,0.0795,1,1,0.0795,0.0795
    99532,,GEORGIA,Tblisi,,1,1,0.0668,0.0668,1,1,0.0668,0.0668
    9953226,,GEORGIA,Mobile Others,,1,1,0.0795,0.0795,1,1,0.0795,0.0795
    9953297,,GEORGIA,Tbilisi city,,1,1,0.0795,0.0795,1,1,0.0795,0.0795
    99544,,GEORGIA,Abkhazia,,1,1,0.3,0.3,1,1,0.3,0.3
    99555,,GEORGIA,Mobile Geocell,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99557,,GEORGIA,Mobile Geocell,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99558,,GEORGIA,Mobile Geocell,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99571,,GEORGIA,Mobile Others,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99574,,GEORGIA,Mobile Others,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99577,,GEORGIA,Mobile,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99577,,GEORGIA,Mobile,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99579,,GEORGIA,Mobile Others,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    9959,,GEORGIA,Mobile,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99593,,GEORGIA,Mobile,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99597,,GEORGIA,Mobile,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    99599,,GEORGIA,Mobile,,1,1,0.1528,0.1528,1,1,0.1528,0.1528
    30,,GREECE,Proper,,1,1,0.019,0.019,1,1,0.019,0.019
    BAT FILE
    REM LOADING VOIP Prices
    sqlldr system/manager@test control=C:\Library\Control\VOIP.CTL data=C:\Library\Data\VOIP.txt log=C:\Library\Log\VOIP.log rows=10000
    PAUSE
    TABLE
    -- Create table
    create table VOIP
    (
      destination             NUMBER,
      destination_group       NUMBER,
      country                 VARCHAR2(65),
      description             VARCHAR2(60),
      off_peak_period         NUMBER,
      first_interval          NUMBER,
      next_interval           NUMBER,
      first_price             NUMBER,
      next_price              NUMBER,
      off_peak_first_interval NUMBER,
      off_peak_next_interval  NUMBER,
      off_peak_first_price    NUMBER,
      off_peak_next_price     NUMBER,
      payback_rate            NUMBER,
      forbidden               NUMBER,
      hidden                  NUMBER,
      discontinued            NUMBER,
      effective_from          DATE,
      formula                 NUMBER,
      report_date             DATE
    )
    tablespace TEST
      pctfree 10
      initrans 1
      maxtrans 255
      storage
      (
        initial 560M
        next 1M
        minextents 1
        maxextents unlimited
      );
    I get the following error message, but the message seems meaningless, as the comma are in fact. Any ideas?


    ORA-28002: the password will expire in 6 days
    SQL * Loader-350: error of syntax in line 7.
    Expected ', 'or') ', found 'destination_group '.
    destination_group INTEGER EXTERNAL

    You are missing commas in the CTL file

    HTH
    Srini

  • TRIM trailing white space in SQLLDR

    Hi all

    I use a script sqlldr to load data into the staging of the table, I have a column named location as the last column in the csv file.

    When I load this file using SQLLDR, there is finally an extra space in location data, inserted into the table. Note: The location is the last column in my table and file.

    I used the TRIM function, but it seems to not work.

    Y at - it options to adjust the white space at the end of the last column of the file.

    Here is my script sqlldr

    DOWNLOAD THE DATA

    ADD

    IN THE XXGDC_ADP_HR_STAGING TABLE

    WHEN (numero_fichier <>"file #")

    FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "

    TRAILING NULLCOLS

    (

    DISPOSABLE FILLER,

    NUMERO_FICHIER ': NUMERO_FICHIER, '

    POSITION_ID ": POSITION_ID."

    LAST_NAME ': LAST_NAME, '

    FIRST NAME ': NAME. "

    MIDDLE_NAME ": MIDDLE_NAME,"

    HOME_DEPARTMENT_DESCRIPTION ': HOME_DEPARTMENT_DESCRIPTION, '

    HOME_DEPARTMENT_CODE ': HOME_DEPARTMENT_CODE, '

    JOB_CODE ': JOB_CODE, '

    JOB_TITLE_DESCRIPTION ': JOB_TITLE_DESCRIPTION, '

    REPORTS_TO_NAME ': REPORTS_TO_NAME, '

    HIRE_DATE DATE MM/DD/RRRR"."

    TERMINATION_DATE DATE MM/DD/RRRR"."

    ASSIGNMENT_START_DATE DATE MM/DD/RRRR"."

    BADGE ": BADGE."

    TYPE ': GENDER. "

    "RTRIM (LTRIM (:LOCATION))," LOCATION

    ADP_HR_FILE_ID "$LOAD_IDENTIFIER"

    Constant of FILE name "$FILE_NAME."

    FILE_LINE_NUMBER SEQUENCE (1,1).

    CONSTANT RECORD_STATUS 'N',

    CREATION_DATE 'SYSDATE,'

    CREATED_BY '$USERID. "

    LAST_UPDATE_DATE 'SYSDATE,'

    LAST_UPDATED_BY "$USERID"

    LAST_UPDATE_REQUEST_ID "$REQID".

    )

    Thanks for you a valuable time and help.

    Thank you

    Olivier

    Thank you people.

    I found the solution, I used RTRIM (LTRIM (: RENTAL), CHR (13)) and that solved my problem.

    Thank you

    Olivier

  • Date fromats loading using SQL * Loader

    Hello

    I have the data to load into an Oracle DB using sqlldr below

    333. 789. 6 ||| 01-08-2013 | 2014-08-01 |

    334. 789. 6 ||| 01-08-2013 | 2014-08-01 |

    335. 789. 6 ||| 01-08-2013 | 2014-08-01 |

    It fails while the failed to load on date formats. How can I fix everything by using load data.

    Thank you

    Sylvie

    Works for me. You must validate the CTL file.

    Here is an example:

    Control line: -.

    DOWNLOAD THE DATA

    INFILE *.

    IN THE TABLE test_table

    REPLACE

    FIELDS TERMINATED BY ', '.

    (

    Col DATE 'yyyy-mm-dd ".

    )

    BEGINDATA

    2013-08-01

    2014-09-01

    2015-10-01

    2016-11-01

    2017-12-01

    -Create table

    SQL > create table test_table (date of the pass);

    Table created.

    -SQL * Loader

    C:\Users\43729434>sqlldr user/password@db_alias name control=C:\fakepath\test_ctl.ctl

    SQL * Loader: release 11.2.0.1.0 - Production Tue Oct 24 10:26:40 2013

    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

    Commit the point reached - the number of logical records 4
    Commit the point reached - the number of logical records 5

    -Check the data in the database

    SQL > alter session set nls_date_format = 'DD-Mon-YYYY ';

    Modified session.

    SQL > select col from test_table;

    COL
    -----------
    August 1, 2013
    01-sep-2014
    October 1, 2015
    November 1, 2016
    December 1, 2017

    SQL >

  • Problem loading xml using sql loader file

    I am trying to load data into the table test_xml (xmldata XMLType)

    I have an xml file and I want any file to load in a single column

    When I use the following control file and run from the command-line as follows
    sqlldr $1@$TWO_TASK direct control=$XXTOP/bin/LOAD_XML.ctl = true; :

    DOWNLOAD THE DATA
    INFILE *.
    TRUNCATE INTO TABLE test_xml
    XmlType (XMLDATA)
    FIELDS
    (
    tank fill ext_fname (100),
    XMLDATA LOBFILE (ext_fname) COMPLETED BY expressions of folklore
    )
    START DATA
    U01/appl/apps/apps_st/appl/XXTop/12.0.0/bin/file. XML

    the file is loaded in the table perfectly.

    Unfortunately I can't hard-code the name of file as file name will be changed dynamically.

    so I removed the block

    START DATA
    U01/appl/apps/apps_st/appl/XXTop/12.0.0/bin/file. XML

    control file and tried to run by giving the following command line path

    sqlldr $1@$TWO_TASK control=$XXTOP/bin/LOAD_XML.ctl direct data=/u01/APPL/apps/apps_st/appl/xxtop/12.0.0/bin/file.xml = true;

    But strangely it attempts to load each line of the xml file in the table instead of the whole file

    Please find the log of the program with the error

    ------------------------------------------------------------------
    Loading XML through SQL * Loader begins
    ------------------------------------------------------------------
    SQL * Loader-502: cannot open the data file ' <? XML version = "1.0"? > ' table field TEST_XML XMLDATA
    SQL * Loader-553: file not found
    SQL * Loader-509: System error: no such file or directory
    SQL * Loader-502: cannot open the data file '< root >' XMLDATA field table TEST_XML
    SQL * Loader-553: file not found
    SQL * Loader-509: System error: no such file or directory
    SQL * Loader-502: cannot open the data file '< ScriptFileType >' field XMLDATA table TEST_XML
    SQL * Loader-553: file not found
    SQL * Loader-509: System error: no such file or directory
    SQL * Loader-502: cannot open the data file ' < Type > forms < / Type > ' table field TEST_XML XMLDATA
    SQL * Loader-553: file not found
    SQL * Loader-509: System error: no such file or directory
    SQL * Loader-502: cannot open the data file ' < / ScriptFileType > ' table field TEST_XML XMLDATA
    SQL * Loader-553: file not found
    SQL * Loader-509: System error: no such file or directory
    SQL * Loader-502: cannot open the data file '< ScriptFileType >' field XMLDATA table TEST_XML
    SQL * Loader-553: file not found
    SQL * Loader-509: System error: no such file or directory
    SQL * Loader-502: cannot open the data file ' < Type > PLL < / Type > ' table field TEST_XML XMLDATA
    SQL * Loader-553: file not found
    SQL * Loader-509: System error: no such file or directory
    SQL * Loader-502: cannot open the data file ' < / ScriptFileType > ' table field TEST_XML XMLDATA
    SQL * Loader-553: file not found
    SQL * Loader-509: System error: no such file or directory
    SQL * Loader-502: cannot open the data file '< ScriptFileType >' field XMLDATA table TEST_XML

    Please help me how can I load full xml in a single column using command line without Hardcoding in the control file

    Published by: 907010 on January 10, 2012 02:24

    But strangely it attempts to load each line of the xml file in the table instead of the whole file

    Nothing strange, that the data parameter specifies the file containing the data to load.
    If you use the name of the XML here, the control file will try to interpret each line of XML as being separate ways.

    The traditional approach this is to have the name of the file stored in another file, say filelist.txt and use, for example:

    echo "/u01/APPL/apps/apps_st/appl/xxtop/12.0.0/bin/file.xml" > filelist.txt
    sqlldr $1@$TWO_TASK control=$XXTOP/bin/LOAD_XML.ctl data=filelist.txt direct=true;
    
  • How to use SQL * Loader to load the XMLType column with other columns?

    Hello

    I try to use sqlldr to load an XML file into a table with an XMLType column. I have found many examples where the entire table is an xmltype, but I'd like to load a lot of XML objects in a generic table for treatment with a single XMLType column and other columns to identify the load. A simple example, I have a constant column which I want to put during the download.

    The following example does not work: (.) No error either.

    create the table xml_upload
    (the varchar2 (10) of upload_type not null,)
    donnees_xml XMLType)
    /

    my control file:
    DOWNLOAD THE DATA
    INFILE * add
    IN THE TABLE xml_upload
    XMLType (xml_data)
    FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "
    (
    constant upload_type MARKET,
    donnees_xml
    )
    BEGINDATA
    < SALE_ORDER >
    TIM < CUST_CODE > < / CUST_CODE >
    < ORDER_NUM > 1234 > < / ORDER_NUM >
    < / SALE_ORDER >


    $ sqlldr my.ctl

    SQL * Loader: Release 10.2.0.4.0 - Production on Sun Sep 27 22:51:52 2009

    Copyright (c) 1982, 2007, Oracle. All rights reserved.

    Commit the point reached - the number of logical records 4

    SQL > select * from xml_upload;
    no selected line
    SQL >

    Any ideas on how I can do this? Did I miss something...

    I also played with the clause sqlldr lobfile, also without success.

    Current database version is 10g R2.

    Thank you
    Tim.

    The following works in 11.1.0.6

    LOAD DATA
    INFILE *
    INTO TABLE xml_upload TRUNCATE
    (
     upload_type constant 'MARKET'
    ,file_name filler char(100)
    ,xml_data LOBFILE (file_name) TERMINATED BY EOF
    )
    BEGINDATA
    test.xml
    
    SQL> select upload_type,xmlserialize(document xml_data no indent) from xml_upload;
    
    UPLOAD_TYP XMLSERIALIZE(DOCUMENTXML_DATANOINDENT)
    ---------- ----------------------------------------------------------------------
    MARKET        1
    
    SQL> 
    
  • In several fields trailing white space

    Hello

    I just found out that the CHAR fields retain their white space. Is any behavior I want, so I've converted all the columns involved in varchar2, who stopped the problem that happens for future data entry.

    However, I would now like to remove white space at the end of all existing data in the database to help with models comparison without need to use 'trim' or 'like' all the time.

    Is there a quick and easy way (or a free tool available for download) which will go through whole varchar2 field in my database for stripping whitespaces purposes?

    TIA,
    Tom

    Published by: user10498723 on Sep / 03/2009 10:04
    UPDATE table SET column = TRIM(column)
    
  • How to load xml using sql loader data?

    Is there any load script of XML data in a table through sql loader?

    Help me out here...

    Thank you

    You can post your code here? while I can help you... your code format should be like this...

    Example code:

    DOWNLOAD THE DATA

    INFILE *.

    IN THE TABLE po_tab

    ADD

    XMLTYPE (xmldata)

    FIELDS

    (xmldata TANK (2000))

    BEGINDATA

    "" http://www.Oracle.com/po/"xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance"

    "" xsi: schemaLocation = "http://www.oracle.com/PO http://www.oracle.com/scha0/po1.xsd"

    orderDate = "1999-10-20" >

    Alice Smith

    123 maple Street

    Mill Valley

    CA

    90952

    Robert Smith

    8 oak Avenue

    Old town

    PA

    95819

    Hurry, my lawn is going wild!

    Lawn mower

    1

    148.95

    Confirm this is electric

    Baby monitor

    1

    39.98

    1999-05-21

  • user input windows OS when loading data using sql loader

    Hello
    I have the oracle 11g Linux database.
    I have excel sheets with data that must be loaded into the database.
    I have oracle running on my windows client11g.

    When I or anyone else is running the load sql script to load the data, I need to capture the user OS (the one that runs the script of their windows login) and pass it via the sql loader and insert into the table as a column value outside the columns in the excel sheet.

    I think that this could be a very simple solution, I did some research but not just anywhere.
    Can someone guide me on this.

    Thanks in advance.
    Philip.

    Well, I built this example on the fly to show the answer. But it is based on documentation and previous experience with sql * loader or sys_context.

    SQL * Loader Control File Reference
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e16536/ldr_control_file.htm#SUTIL005

    SQL * Loader field list reference
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e16536/ldr_field_list.htm

    SQL - SYS_CONTEXT language reference
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/functions184.htm#SQLRF06117

    This forum is a good source of examples, as well as asktom.oracle.com

  • Need to call the Shell script that uses SQL loader in APex4.1 / 11g

    Hello!

    I have a requirement in which I need to call a shell script that connects to an external server, FTP to a file and then use sqlloader to load data into our table. We have now the ftp script that accomplishes this task to another program, but is a scheduled task. I wanted to call the script ftp in the APEX. Any suggestions on how this can be done, what is the logic of PL/SQL can we use? I saw online some people using DBMS Scheduler for this?

    Thank you
    Sun

    Hello

    Create some sh script on your computer host oracle where you can join in the external server and run the process.
    something like:

    run_external_sh.sh

    #!/bin/sh
    ssh ext_user@ext_host ./sqlloader/import/import.sh
    

    Then create an external TASK to call it via ORACLE (PL/SQL)

    -Shell Script call.

    BEGIN
      DBMS_SCHEDULER.create_program (
        program_name        => 'external_call_sh',
        program_type        => 'EXECUTABLE',
        program_action      => '/local_host/call_external/sh/run_external_sh.sh',
        number_of_arguments => 0,
        enabled             => TRUE,
        comments            => 'Call external SH script');
    END;
    /
    

    You can now create a regular / or unplanned WORK
    -Job defined by the calendar and an existing program.

    BEGIN
      DBMS_SCHEDULER.create_job (
        job_name      => 'jb_external_call_sh',
        program_name  => 'external_call_sh',
        schedule_name => 'external_call_scheduler', -- created scheduler
        enabled       => TRUE,
        comments      => 'Job defined by an existing external_call_sh program and schedule.');
    END;
    /
    

    You can now call the WORK in the APEX in the process of PL/SQL.

    BEGIN
      -- Run job synchronously.
      DBMS_SCHEDULER.run_job (job_name            => 'jb_external_call_sh');
    END;
    

    Concerning
    J :D

  • How to tune the loading using SQL LOADER

    Hi all

    I use SQLLDR to load the file into the target. All the files I am receving is ' | ' delimited. Some of the files size more than 3 GB. It takes a lot of time during loading.

    Help me to know if it is possible of tuner SQLLDR.

    Here is the example of control file.

    DOWNLOAD THE DATA
    UTF8 CHARACTER
    INFILE ' / var/hulu/ptp/ABC.txt'
    BADFILE ' / var/hulu/ptp/ABC.bad'
    DISCARDFILE ' / var/hulu/ptp/ABC.dsc'

    IN THE TABLE "PTP_ABC".
    TRUNCATE

    FIELDS TERMINATED BY ' |'
    TRAILING NULLCOLS
    (
    CODE,
    DESCRIPTION,
    FILLING,
    COKE
    )

    Change you your current sqlldr using external tables, this make the parallel load automatically, or launch sqlldr processes in the background of a single script.

    We doing something similar to this with the help of a shell like this script:

    nohup sqlldr userid=/ data=data01.dat log=my1.log control=my.ctl bad=my1.bad direct=yes silent=all parallel=true &
    nohup sqlldr userid=/ data=data02.dat log=my2.log control=my.ctl bad=my2.bad direct=yes silent=all parallel=true &
    nohup sqlldr userid=/ data=data03.dat log=my3.log control=my.ctl bad=my3.bad direct=yes silent=all parallel=true &
    nohup sqlldr userid=/ data=data04.dat log=my4.log control=my.ctl bad=my4.bad direct=yes silent=all parallel=true &
    nohup sqlldr userid=/ data=data05.dat log=my5.log control=my.ctl bad=my5.bad direct=yes silent=all parallel=true &
    nohup sqlldr userid=/ data=data06.dat log=my6.log control=my.ctl bad=my6.bad direct=yes silent=all parallel=true &
    nohup sqlldr userid=/ data=data07.dat log=my7.log control=my.ctl bad=my7.bad direct=yes silent=all parallel=true &
    ...
    

    We are currently opening 20 simultaneous processes and we get an overal 400 000 platelets per second speed. You test what is the maximum number of concurrent processes, you can open.

    Course which you need a first step to split the log into smaller chuncks. In my example, the file data.dat got cut into 20 smaller files, and each of them at the same time got loaded in parallel in the database. If you can not split the file, then you should go for external tables.

    You can always test direct = true without any parallel option. This should be more than noticiable.

    LW

  • Loading journal excel using sql loader

    Hi all

    I need to load an Excel sheet in our oracle database... and I sheet tht hav converted format CSV... then can someone like me the whole procedure wat can I do now to load data as well as any description as wat control file, file inline means... or if you can send me tht link provides any knowledge...

    Thanks in advance,

    Pankaj

    Pankaj,

    You need to change your data and delimited by "|"or",". "." Try this test, and then make the changes as a result of implementing

    And your command file should look like

    * # yourcontrolfile.ctl*
    {code}
    DOWNLOAD THE DATA
    TRUNCATE INTO TABLE my_new_table
    FIELDS TERMINATED BY ' |'
    SURROUNDED OF POSSIBLY "" "
    TRAILING NULLCOLS
    (
    zip EXTERNAL INTEGER,
    name char (50) - make sure that lengh is your length of table data type
    )

    *# datafile.dat*
    

    501. NEW YORK CITY
    544. NEW YORK CITY
    1001 | SPRINGFIELD-HOLYOKE
    1002 | SPRINGFIELD-HOLYOKE
    1003 | SPRINGFIELD-HOLYOKE
    1004. SPRINGFIELD-HOLYOKE
    1005. BOSTON (MANCHESTER)
    1007 | SPRINGFIELD-HOLYOKE
    1008 | SPRINGFIELD-HOLYOKE
    1009. SPRINGFIELD-HOLYOKE
    1010 | SPRINGFIELD-HOLYOKE

    To test , use following to load, make sure specify path 
    

    sqlldr name of user and password control = yourcontrolfile.ctl data = datafile.dat mylog.log = log

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    

Maybe you are looking for

  • Siri/dictation, not working, showing the voice waves when I don't speak

    Hi all, I have an iPhone 6 and Siri/dictation no longer work. When I start siri, the colored area of sin-wave-looking down immediately starts going crazy, as if I'm talking out loud, even if I am in a quiet room. Previously, he moved only when I was

  • following cartridges appear to be missing or damaged

    Hello I have a HP Officejet 6500 has more. I replaced the ink in the printer several times since I bought it, but I had a LOT of problems with these cartridges. I get the error prompt "the following cartridges appear to be missing or damaged." I have

  • HP laptop - 15-g206ax: HP - 15-g206ax windows 7 driver wifi laptop

    I had windows 8 pre-instatlled. I was in windows 7-32 bit. After all the drivers work correctly except wifi driver. Please help with the wifi driver. laptop model HP for laptop - 15-g206ax

  • HP DVDRAM GT20L ERROR 19

    I have had this PC for 2 years or more. He suddenly left 'See' the DVD player. In Device Manager, I see the error: Windows cannot start this hardware device because its information of configuration (in the registry) is incomplete or damaged. (Code 19

  • How to publish Desktop and the Application of the host, RDSH Quest vworkspace.

    Hi team, I do POC for a customer and using the version 8.0MR1 of quest vworkspace. I have give birth successfully see chased the VDI. Now customer want to see some applications Publish and Desktop Publishing through host RDSH. they use Win7 32 in the