Date format SQL Loader

Hello everyone

I have 2 questions for charger

(1) I need to convert the date value in the csv file, column called closed_date and the value of the time to come as null and sometimes 20101122 22:12:07. I want to insert 'YYYYMMDD HH24:MI:SS' this format.

(2) when I try I load the clob data type column using sql loader its give without endpoints found for this column.

Could you please advice.

Thank you
Bhavana

user13689917 wrote:
Hello

I am getting error below.

column AUTHOR_CLOSED_DATE.
ORA-01841: (full) year must be between-4713 and 9999 and not 0

In the CSV file the AUTHOR_CLOSED_DATE value is a string NULL.

Which seems to indicate that data in the file (at least a part of it) does not follow the format you specified in your control file (and is NOT NULL).

Check the data (original file) as well as SQL loader logs.

Tags: Database

Similar Questions

  • Export data to SQL Loader format bugs?

    I have a problem to the export of large tables in SQL * Loader format files.

    Developer SQL is sitting there with almost all CPU (> 95%) on my machine (I'm only under SQL Developer & Process Explorer) and same constantly redraw (the page is white).

    The .ldr file is created, but seems to be empty. (I would have thought that he would be constantly added to the).

    In fact, nothing happens.

    Does anyone else have this problem? I use SQL Developer 2.1 on XP with a 9i DB.

    NIC

    Unfortunately, this is how things are done now.
    If you have a better suggestion (such as hot flashes automatically recovered rows and the re-use of freed memory), you can always add this as a feature request to the exchange of SQL Developer, for other users can vote to add weight to the possible future implementation. I'd do it.

    Kind regards
    K.

  • Loading data with sql loader

    Hi Experts,

    I have a file in the following format. I have to insert the data from these files in a table. Can I use SQL Loader to load these files.

    My question is that I need to schedule the download of these files. Can I integrate sql loader in a procedure?
    Agent Id|Agent Type|Create Date|Termination CDC|Activation CDC|Deactivation CDC|Agent IdX|Agent Status|Status Date|Status Reason Code|Update CDC|Update Serial|Update User|New Owner Agent Id|Previous Owner Agent Id|Agent Name|Primary Address1|Primary Address2|Primary Address3|Secondary Address1|Secondary Address2|Secondary Address3| Primary City|Primary State|Primary Zip|Primary Zip Suffix|Primary Country|Secondary City|Secondary State|Secondary Zip|Secondary Zip Suffix|Secondary Country|Phone Number|Fax number|Mobile Number|Business Type|Field Rep|Bill to Chain Id|Mon Open Time|Mon Close Time|Tue Open Time|Tue Close Time|Wed Open Time|Wed Close Time|Thu Open Time|Thu Close Time|Fri Open Time|Fri Close Time|Sat Open Time|Sat Close Time|Sun Open Time|Sun Close Time|Zone Id|Line Charge Class|Chain Id|Chain Code| Primary Contact  Name| Primary Contact Title| Primary Contact Phone|Secondary Contact Name|Secondary Contact Title|Secondary Contact Phone|Tertiary contact Name|Tertiary Contact Title|Tertiary Contact Phone| Bank Id| Bank Account Id| bank Account Type| Bank Account Date| EFT Flag| Fund Limit|Invoicable|TaxCode|Tax Id|Sales Tax|Service Charge|Instant Cashing Type|Instant Telsel Rep| Instant Number of Bins| Instant Number Itvms| InstantCredit Limit|Auto Reorder| Instant Terminal Reorder| Instant Telsel Reorder| Instant Teleset Active CDC| Instant Initial Distribution|Auto Telsel Schedule| Instant Auto Settle| Instant Call Day| Instant Call Week| Instant Call Cycle| Instant Order Restriction| Instant Delivery Flag| Instant Account Type| Instant Settle Class| Region|County|Territory|Route|Chain Statement|Master Agent Id| Minority Owned| Tax Name| State Tax Id|Mailing Name| Bank Account Name| DSR
    0|1|0|0|0|0|0|1|0|0|302|0|0|0|0|||||||||||||||||||||0|0|0|||||||||||||||0|0|0|||||||||||||0|-2145916800|0|0|0|0||0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0||0|0|0|||||
    1|1|1256213087|0|-39081|-39081|1|2|1256213087|999|302|0|0|0|0|Pseudo Outlet||||||||MU|||MU||MU|||MU||||0|0|1|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|06:00|23:59|0|0|0|||||||||||||
    {code)
    
    Edited by: Kevin CK on 02-Feb-2010 03:28                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Here you go...

    drop table agent_dump_csv_temp
    /
    
    create table agent_dump_csv_temp
      (Agent_Id                   NUMBER
      ,Agent_Type                 NUMBER
      ,Create_Date                NUMBER
      ,Termination_CDC            NUMBER
      ,Activation_CDC             NUMBER
      ,Deactivation_CDC           NUMBER
      ,Agent_IdX                  NUMBER
      ,Agent_Status               NUMBER
      ,Status_Date                NUMBER
      ,Status_Reason_Code         NUMBER
      ,Update_CDC                 NUMBER
      ,Update_Serial              NUMBER
      ,Update_User                NUMBER
      ,New_Owner_Agent_Id         NUMBER
      ,Previous_Owner_Agent_Id    NUMBER
      ,Agent_Name                 VARCHAR2(50)
      ,Primary_Address1           VARCHAR2(50)
      ,Primary_Address2           VARCHAR2(50)
      ,Primary_Address3           VARCHAR2(50)
      ,Secondary_Address1         VARCHAR2(50)
      ,Secondary_Address2         VARCHAR2(50)
      ,Secondary_Address3         VARCHAR2(50)
      ,Primary_City               VARCHAR2(50)
      ,Primary_State              VARCHAR2(50)
      ,Primary_Zip                VARCHAR2(50)
      ,Primary_Zip_Suffix         VARCHAR2(50)
      ,Primary_Country            VARCHAR2(50)
      ,Secondary_City             VARCHAR2(50)
      ,Secondary_State            VARCHAR2(50)
      ,Secondary_Zip              VARCHAR2(50)
      ,Secondary_Zip_Suffix       VARCHAR2(50)
      ,Secondary_Country          VARCHAR2(50)
      ,Phone_Number               VARCHAR2(50)
      ,Fax_number                 VARCHAR2(50)
      ,Mobile_Number              VARCHAR2(50)
      ,Business_Type              NUMBER
      ,Field_Rep                  NUMBER
      ,Bill_to_Chain_Id           NUMBER
      ,Mon_Open_Time              VARCHAR2(5)
      ,Mon_Close_Time             VARCHAR2(5)
      ,Tue_Open_Time              VARCHAR2(5)
      ,Tue_Close_Time             VARCHAR2(5)
      ,Wed_Open_Time              VARCHAR2(5)
      ,Wed_Close_Time             VARCHAR2(5)
      ,Thu_Open_Time              VARCHAR2(5)
      ,Thu_Close_Time             VARCHAR2(5)
      ,Fri_Open_Time              VARCHAR2(5)
      ,Fri_Close_Time             VARCHAR2(5)
      ,Sat_Open_Time              VARCHAR2(5)
      ,Sat_Close_Time             VARCHAR2(5)
      ,Sun_Open_Time              VARCHAR2(5)
      ,Sun_Close_Time             VARCHAR2(5)
      ,Zone_Id                    NUMBER
      ,Line_Charge_Class          NUMBER
      ,Chain_Id                   NUMBER
      ,Chain_Code                 NUMBER
      ,Primary_Contact_Name       VARCHAR2(50)
      ,Primary_Contact_Title      VARCHAR2(50)
      ,Primary_Contact_Phone      VARCHAR2(50)
      ,Secondary_Contact_Name     VARCHAR2(50)
      ,Secondary_Contact_Title    VARCHAR2(50)
      ,Secondary_Contact_Phone    VARCHAR2(50)
      ,Tertiary_contact_Name      VARCHAR2(50)
      ,Tertiary_Contact_Title     VARCHAR2(50)
      ,Tertiary_Contact_Phone     VARCHAR2(50)
      ,Bank_Id                    NUMBER
      ,Bank_Account_Id            NUMBER
      ,Bank_Account_Type          NUMBER
      ,Bank_Account_Date          NUMBER
      ,EFT_Flag                   NUMBER
      ,Fund_Limit                 NUMBER
      ,Invoicable                 NUMBER
      ,TaxCode                    NUMBER
      ,Tax_Id                     NUMBER
      ,Sales_Tax                  NUMBER
      ,Service_Charge             NUMBER
      ,Instant_Cashing_Type       NUMBER
      ,Instant_Telsel_Rep         NUMBER
      ,Instant_Number_of_Bins     NUMBER
      ,Instant_Number_Itvms       NUMBER
      ,InstantCredit_Limit        NUMBER
      ,Auto_Reorder               NUMBER
      ,Instant_Terminal_Reorder   NUMBER
      ,Instant_Telsel_Reorder     NUMBER
      ,Instant_Teleset_Active_CDC NUMBER
      ,Instant_Initial_Distribution NUMBER
      ,Auto_Telsel_Schedule       NUMBER
      ,Instant_Auto_Settle        NUMBER
      ,Instant_Call_Day           NUMBER
      ,Instant_Call_Week          NUMBER
      ,Instant_Call_Cycle         NUMBER
      ,Instant_Order_Restriction  NUMBER
      ,Instant_Delivery_Flag      NUMBER
      ,Instant_Account_Type       NUMBER
      ,Instant_Settle_Class       NUMBER
      ,Region                     NUMBER
      ,County                     NUMBER
      ,Territory_x                NUMBER
      ,Route                      NUMBER
      ,Chain_Statement            NUMBER
      ,Master_Agent_Id            NUMBER
      ,Minority_Owned             NUMBER
      ,Tax_Name                   VARCHAR2(50)
      ,State_Tax_Id               NUMBER
      ,Mailing_Name               VARCHAR2(50)
      ,Bank_Account_Name          VARCHAR2(50)
      ,DSR                        NUMBER
      )
      ORGANIZATION EXTERNAL (
       TYPE oracle_loader
        DEFAULT DIRECTORY TEST_DIR
        ACCESS PARAMETERS (
          RECORDS DELIMITED BY NEWLINE
          SKIP 1
          BADFILE 'test.bad'
          DISCARDFILE 'test.dis'
          LOGFILE 'test.log'
          FIELDS TERMINATED BY '|'
          MISSING FIELD VALUES ARE NULL
          REJECT ROWS WITH ALL NULL FIELDS
            (Agent_Id
            ,Agent_Type
            ,Create_Date
            ,Termination_CDC
            ,Activation_CDC
            ,Deactivation_CDC
            ,Agent_IdX
            ,Agent_Status
            ,Status_Date
            ,Status_Reason_Code
            ,Update_CDC
            ,Update_Serial
            ,Update_User
            ,New_Owner_Agent_Id
            ,Previous_Owner_Agent_Id
            ,Agent_Name
            ,Primary_Address1
            ,Primary_Address2
            ,Primary_Address3
            ,Secondary_Address1
            ,Secondary_Address2
            ,Secondary_Address3
            ,Primary_City
            ,Primary_State
            ,Primary_Zip
            ,Primary_Zip_Suffix
            ,Primary_Country
            ,Secondary_City
            ,Secondary_State
            ,Secondary_Zip
            ,Secondary_Zip_Suffix
            ,Secondary_Country
            ,Phone_Number
            ,Fax_number
            ,Mobile_Number
            ,Business_Type
            ,Field_Rep
            ,Bill_to_Chain_Id
            ,Mon_Open_Time
            ,Mon_Close_Time
            ,Tue_Open_Time
            ,Tue_Close_Time
            ,Wed_Open_Time
            ,Wed_Close_Time
            ,Thu_Open_Time
            ,Thu_Close_Time
            ,Fri_Open_Time
            ,Fri_Close_Time
            ,Sat_Open_Time
            ,Sat_Close_Time
            ,Sun_Open_Time
            ,Sun_Close_Time
            ,Zone_Id
            ,Line_Charge_Class
            ,Chain_Id
            ,Chain_Code
            ,Primary_Contact_Name
            ,Primary_Contact_Title
            ,Primary_Contact_Phone
            ,Secondary_Contact_Name
            ,Secondary_Contact_Title
            ,Secondary_Contact_Phone
            ,Tertiary_contact_Name
            ,Tertiary_Contact_Title
            ,Tertiary_Contact_Phone
            ,Bank_Id
            ,Bank_Account_Id
            ,Bank_Account_Type
            ,Bank_Account_Date
            ,EFT_Flag
            ,Fund_Limit
            ,Invoicable
            ,TaxCode
            ,Tax_Id
            ,Sales_Tax
            ,Service_Charge
            ,Instant_Cashing_Type
            ,Instant_Telsel_Rep
            ,Instant_Number_of_Bins
            ,Instant_Number_Itvms
            ,InstantCredit_Limit
            ,Auto_Reorder
            ,Instant_Terminal_Reorder
            ,Instant_Telsel_Reorder
            ,Instant_Teleset_Active_CDC
            ,Instant_Initial_Distribution
            ,Auto_Telsel_Schedule
            ,Instant_Auto_Settle
            ,Instant_Call_Day
            ,Instant_Call_Week
            ,Instant_Call_Cycle
            ,Instant_Order_Restriction
            ,Instant_Delivery_Flag
            ,Instant_Account_Type
            ,Instant_Settle_Class
            ,Region
            ,County
            ,Territory_x
            ,Route
            ,Chain_Statement
            ,Master_Agent_Id
            ,Minority_Owned
            ,Tax_Name
            ,State_Tax_Id
            ,Mailing_Name
            ,Bank_Account_Name
            ,DSR
          )
        )
        LOCATION ('test.txt')
      )
      PARALLEL
     REJECT LIMIT UNLIMITED
    /
    
    SQL> select * from agent_dump_csv_temp
      2  /
    
      AGENT_ID AGENT_TYPE CREATE_DATE TERMINATION_CDC ACTIVATION_CDC DEACTIVATION_CDC  AGENT_IDX AGENT_STATUS STATUS_DATE STATUS_REASON_CODE UPDATE_CDC UPDATE_SERIAL UPDATE_USER NEW_OWNER_AGENT_ID PREVIOUS_OWNER_AGENT_ID
    ---------- ---------- ----------- --------------- -------------- ---------------- ---------- ------------ ----------- ------------------ ---------- ------------- ----------- ------------------ -----------------------
    AGENT_NAME                                         PRIMARY_ADDRESS1                                   PRIMARY_ADDRESS2                                   PRIMARY_ADDRESS3
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_ADDRESS1                                 SECONDARY_ADDRESS2                                 SECONDARY_ADDRESS3                                 PRIMARY_CITY
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    PRIMARY_STATE                                      PRIMARY_ZIP                                        PRIMARY_ZIP_SUFFIX                                 PRIMARY_COUNTRY
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_CITY                                     SECONDARY_STATE                                    SECONDARY_ZIP                                      SECONDARY_ZIP_SUFFIX
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    SECONDARY_COUNTRY                                  PHONE_NUMBER                                       FAX_NUMBER                                         MOBILE_NUMBER                                      BUSINESS_TYPE  FIELD_REP BILL_TO_CHAIN_ID
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------- ---------- ----------------
    MON_O MON_C TUE_O TUE_C WED_O WED_C THU_O THU_C FRI_O FRI_C SAT_O SAT_C SUN_O SUN_C    ZONE_ID LINE_CHARGE_CLASS   CHAIN_ID CHAIN_CODE PRIMARY_CONTACT_NAME                               PRIMARY_CONTACT_TITLE
    ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---------- ----------------- ---------- ---------- -------------------------------------------------- --------------------------------------------------
    PRIMARY_CONTACT_PHONE                              SECONDARY_CONTACT_NAME                             SECONDARY_CONTACT_TITLE                            SECONDARY_CONTACT_PHONE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
    TERTIARY_CONTACT_NAME                              TERTIARY_CONTACT_TITLE                             TERTIARY_CONTACT_PHONE                                BANK_ID BANK_ACCOUNT_ID BANK_ACCOUNT_TYPE BANK_ACCOUNT_DATE   EFT_FLAG FUND_LIMIT INVOICABLE
    -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------- --------------- ----------------- ----------------- ---------- ---------- ----------
       TAXCODE     TAX_ID  SALES_TAX SERVICE_CHARGE INSTANT_CASHING_TYPE INSTANT_TELSEL_REP INSTANT_NUMBER_OF_BINS INSTANT_NUMBER_ITVMS INSTANTCREDIT_LIMIT AUTO_REORDER INSTANT_TERMINAL_REORDER INSTANT_TELSEL_REORDER INSTANT_TELESET_ACTIVE_CDC
    ---------- ---------- ---------- -------------- -------------------- ------------------ ---------------------- -------------------- ------------------- ------------ ------------------------ ---------------------- --------------------------
    INSTANT_INITIAL_DISTRIBUTION AUTO_TELSEL_SCHEDULE INSTANT_AUTO_SETTLE INSTANT_CALL_DAY INSTANT_CALL_WEEK INSTANT_CALL_CYCLE INSTANT_ORDER_RESTRICTION INSTANT_DELIVERY_FLAG INSTANT_ACCOUNT_TYPE INSTANT_SETTLE_CLASS     REGION     COUNTY TERRITORY_X
    ---------------------------- -------------------- ------------------- ---------------- ----------------- ------------------ ------------------------- --------------------- -------------------- -------------------- ---------- ---------- -----------
         ROUTE CHAIN_STATEMENT MASTER_AGENT_ID MINORITY_OWNED TAX_NAME                                        STATE_TAX_ID MAILING_NAME                                          BANK_ACCOUNT_NAME                                 DSR
    ---------- --------------- --------------- -------------- -------------------------------------------------- ------------ -------------------------------------------------- -------------------------------------------------- ----------
             0          1           0               0              0                0          0            1       0                      0        302             0           0                  0                       0
    
                                                                                                                                                                                                                    0          0                0
                                                                                                 0                 0          0
    
                                                                                                                                                                                                0        -2.146E+09          0          0          0
             0                     0              0                    0                  0                      0                    0                   0            0                        0                      0                          0
                               0                    0                   0                1                 0          0                         0                     0                    0                    0          0          0           0
                             0               0              0
    
             1          1  1256213087               0         -39081           -39081          1            2  1256213087                999        302             0           0                  0                       0
    Pseudo Outlet
    
    MU                                                                                                                                               MU
                                                       MU
    MU                                                                                                                                                                                                       0         0                1
    06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59 06:00 23:59          0              0     0
    
                                                                                                                                                                                                1        -2.146E+09          1          0          1
             0                     0              0                    0                  0                      0                    0                   0            0                        0                      0                      -3287
                               0                    0                   0                1                 1          2                         0                     0                    0                    1          0        999           0
                             5               0              0
    
    SQL>
    

    He dislikes the identifier 'territory', so I renamed it to "territory_x" (I guess that's a reserved word).
    Your initial problem you had was your fields "SEPARATED"... instead of "TERMINATED" by. ;)

  • 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)

  • 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

  • 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

  • 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

  • Error SQL Loader loading a field date

    Hello

    I get the error while I'm trying to load a table with a field of date using SQL Loader below

    Sheet 1: Rejected - error on the table RPT_HOST_USAGE, column USAGE_TIMESTAMP.
    ORA-01861: literal does not match the format string


    My input file is as below
    < code >
    Host_Usage_ID, Host_ID, Technology_ID, Environment_ID, Usage_Timestamp, Avg_CPU_Pct, Avg_Memory_MB, CPU_Spike
    1,12,1,8,'2009-08-01 00:00:00 ', 0.000000000, 23875.000000000, 0.000000000
    < code >

    My Loader.ctl is
    < code >
    OPTIONS (SKIP = 1)
    load data
    INFILE 'C:\rpt_Host_Usage.txt '.
    in the RPT_HOST_USAGE table
    fields completed by «,»
    (
    HOST_USAGE_ID,
    HOST_ID,
    TECHNOLOGY_ID,
    ENVIRONMENT_ID,
    USAGE_TIMESTAMP,
    AVG_CPU_PCT,
    AVG_MEMORY_MB,
    CPU_SPIKE
    )
    < code >

    I tried options like USAGE_TIMESTAMP TO_DATE(USAGE_TIMESTAMP,'YYYY-MM-DD HH24:MI:SS') but did not...
    Can you please tell me how to fix this?

    Pointers on it will be useful

    Thank you

    Mahesh

    I went back and looked at some of my old files of *.ctl and I did something simlilar to what you mentioned and it worked for me, but I was surrounded by the quotes option and included a colon in front of the element. Example:

    ...
    TECHNOLOGY_ID,
    ENVIRONMENT_ID,
    USAGE_TIMESTAMP ' to_date (: USAGE_TIMESTAMP, "YYYY-MM-DD HH24:MI:SS)."
    AVG_CPU_PCT,
    AVG_MEMORY_MB,
    ....

  • Name of dynamic INFILE SQL loader

    Hi all

    I use oracle 10g on windows server.

    I have a log on a remote server. each line in the log file is as below

    LogIN Mar 02/09/2014 10:10:48 ss18 N419FS40 1

    I create a table for that as below;

    Create table free_pc (log_in varchar2(10),log_day varchar2(10),log_date date,log_time date,log_user varchar2(30),log_Lab varchar2(30),log_pc varchar2(30), log_status char(1));
    

    I have two problems;

    1 N419FS40, the N419 is the name of a student in the lab, while FS40 is the name of the computer in this laboratory. I want only the first four characters to be inserted into the column of Log_lab and the rest of characters iin Log_pc column. my control file is less than

    DOWNLOAD THE DATA

    INFILE '\\remote_location\login02_09_14.txt '.

    ADD

    IN THE TABLE free_pc

    FIELDS FINISHED WITH A WHITE SPACE

    (log_in,

    log_day,

    log_date DATE "DD/MM/YYYY",

    log_time DATE "HH24 MI SS."

    LOG_USER,

    log_Lab,

    log_PC,

    log_status

    )

    How to do this?

    2. the log file is generated on the server, every day with a different name, he cancatenate the current date with Word LOGIN, for example login02_09_14.txt, login03_09_14.txt and login04_09_14 etc. in my INFILE tag, how can I put the name, so that it automatically take the name of the remote location?

    Thank you.

    Kind regards.

    1. you can use the SUBSTR function to separate the two values.  You put the fields in the control file in the same order in the data file, with all the columns that are formulated from data in other areas at the end.

    2. There are different ways to do this.  The file name can be in the control file or the SQL * Loader command line.  You can create either using SQL/SQL * Plus or operating system commands.  I tend to prefer change just the line of SQL * Loader command line, instead of the entire control file.  I prefer to do this in a SQL file instead of a file breaks Windows or * ix shell script or something, so that it is independent of the operating system.

    In addition, it is best to store all of your day, date and time in a column, then you can use to_char to display it as you want, in a column, or two or three.

    Please see the example below, in which I have shown above.

    Scott@ORCL >-data file you provided with the name changed to include today's date:

    Scott@ORCL > HOST TYPE 'c:\remote_location\login27_04_15.txt '.

    Opening on Tuesday, September 2, 2014 ss18 N419FS40 1 10:10:48

    Scott@ORCL >-control file with no infile, fields in the order of the data file, using fill for the unused columns,.

    Scott@ORCL >-with forumulated columns, using boundfiller for filling necessary for columns columns drawn up:

    Scott@ORCL > test.ctl TYPE of HOST

    DOWNLOAD THE DATA

    ADD

    IN THE TABLE free_pc

    FIELDS FINISHED WITH A WHITE SPACE

    TRAILING NULLCOLS

    (log_in,

    log_day FILLING,

    log_date BOUNDFILLER,

    log_time BOUNDFILLER,

    LOG_USER,

    log_Lab ' SUBSTR (: log_lab, 1, 4). "

    log_status,

    log_date_time ' TO_DATE (: log_date |: log_time, "MM/DD / YYYYHH24:MI:SS'"). "

    log_PC ' SUBSTR (: log_lab, 5) ')

    Scott@ORCL >-sql script which now enables to get the data and it concatenates the file name with the path of the directory

    Scott@ORCL >- and loads the data running SQL * Loader of SQL * Plus, using the HOST command:

    Scott@ORCL > test.sql TYPE of HOST

    COLUMN data_file new_value data_file

    SELECT 'c:\remote_location\login ' | TO_CHAR (SYSDATE, 'DD_MM_YY'). ".txt" AS data_file FROM DUAL

    /

    HOST SQLLDR scott/tiger CONTROL = test.ctl DATA = '& data_file' LOG = test.log

    CLEAR COLUMN

    Scott@ORCL >-table which includes the date and time in a column, for the day of the week can be extracted:

    Scott@ORCL > create table free_pc

    2 (log_in varchar2 (10))

    3, date log_date_time

    4, log_user varchar2 (30)

    5, log_Lab varchar2 (30)

    6, log_pc varchar2 (30)

    7, log_status char (1))

    8.

    Table created.

    Scott@ORCL >-load data file sql running running SQL * Loader using the control file:

    Scott@ORCL > test.sql START

    Scott@ORCL > data_file new_value data_file COLUMN

    Scott@ORCL > SELECT 'c:\remote_location\login ' | TO_CHAR (SYSDATE, 'DD_MM_YY'). ".txt" AS data_file FROM DUAL

    2.

    DATA_FILE

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

    c:\remote_location\login27_04_15.txt

    1 selected line.

    Scott@ORCL > HOST SQLLDR scott/tiger CONTROL = test.ctl DATA = '& data_file' LOG = test.log

    SQL * Loader: release 11.2.0.1.0 - Production on my Apr 27 12:00:53 2015

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

    Commit the point reached - the number of logical records 1

    Scott@ORCL > CLEAR COLUMN

    Scott@ORCL >-results with Date_Time field displayed in the form of day, date and time:

    Scott@ORCL > log_in COLUMN FORMAT A6

    Scott@ORCL > log_day COLUMN FORMAT A7

    Scott@ORCL > log_user COLUMN FORMAT A8

    Scott@ORCL > log_lab COLUMN FORMAT A8

    Scott@ORCL > log_pc COLUMN FORMAT A6

    Scott@ORCL > log_status FORMAT A10 COLUMN

    Scott@ORCL > SELECT log_in,.

    2 TO_CHAR (log_date_time, ' HH24:MI:SS Dy DD-Mon-YYYY ') ' DAY DATE TIME. "

    3 log_user, log_lab, log_pc, log_status

    4 FROM free_pc

    5.

    LOG_IN DAY DATE TIME LOG_USER LOG_LAB LOG_PC LOG_STATUS

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

    LogIN Mar 02 - Sep - 2014 ss18 N419 FS40 1 10:10:48

    1 selected line.

  • SQL Loader: Is it possible to set a variable?

    Hello all,.

    I'm loading of data with SQL Loader and find that I can put specific fields of the particular values using 'CONSTANT '. That's great. However, I am load several files in the same format and would like to 'label' each load. This would be by setting a variable before each load and then this to help write the month of the load (e.g. '200901') in the "SOURCE_FILE" column in the destination table.

    I imagine that the syntax would look something like this...

    DOWNLOAD THE DATA

    strSource = '200809'
    INFILE 'source_data_200809.csv '.
    strSource = '200810'
    INFILE 'source_data_200810.csv '.
    strSource = '200811'
    INFILE 'source_data_200811.csv '.

    ADD

    IN THE TABLE DESTINATION_TABLE
    FIELDS TERMINATED BY '; '. SURROUNDED OF POSSIBLY "" "
    TRAILING NULLCOLS
    (Char CUSTNO,
    Barcode tank,
    NAME char,
    Char SOURCE_FILE: strSource)

    Then, for each load I refer to the strSource variable and write the month appropriate in a column/field in the table.

    I've been googling and trawling through the documentation, but I can't seem to find a way to do it. Is this possible? Or maybe there's another method/path/tip for that? Or maybe it's just a matter of syntax?

    Any ideas?

    Kind regards
    Alan Searle

    Hello

    What will be the size of the file...?
    Instead, you can fill the data column in the .csv if possible in the worst case
    apply the ' TO_DATE (: fichier_source, 'YYYYMMDD').

    -Pavan Kumar N

  • SQL Loader - does not

    I have Oracle 11 g R2 running on Windows Server 2008 R2

    When trying to load the data (csv file) with SQL Loader in Enterprise Manager, he told me the work successfully completed, but there is no data in the table. The bat is created as the ctl and sh file. I checked that sqldr is in my directory \bin to $ORACLE_HOME$ and I checked that this 'path' is also in my path environment variable. When I try to run it from the command line that I don't get recognized as builtin or external, an executable program or batch file. I try to run it in SQL Developer, and after his execution, it is said canceled task. Can help you. I expect a record 70 million next week and I want to use SQL Loader.

    Message from Enterprise Manager
    State managed
    Exit code 0
    31327 step ID
    Target leads.global
    Started may 10, 2013 15:55:14 (UTC-07:00)
    Ended May 10, 2013 15:55:22 (UTC-07:00)
    Step 8 seconds
    WIN Service Management - D1CINRVM11K:1158_Management_Service
    Including the job step ADVANCED management service was sent.



    Natural logarithm of output


    User name:
    SQL * Loader: release 11.2.0.1.0 - Production Friday, may 10, 15:55:15 2013

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


    Loaded - the number of logical records 51.

    I usually run SQL * Loader of SQL * Plus, so that it avoids some of the questions of privilege. I also use a log file, so that I can check later to see what happened and why. For example:

    host sqlldr scott/tiger control = test.ctl log = test.log

    A common question is the lack of privileges for the data file to load. You can change an empty file in SQL * more and copy and paste the data into it, to eliminate such problems or identify them, so that you can check the privileges on the original file.

    To provide a lot of other things, we would need more information, such as a few lines of sample data, your SQL * Loader control file and the structure of your table.

  • query SQL loader

    Hello

    I load a CSV for emp table data using sql loader.
    I wrote the control as file below. How to run so that the data can be inserted into the emp table.

    Control file:
    DOWNLOAD THE DATA
    INFILE ' C:\VINOD\EMP_DATA. CSV'
    INSERT INTO THE TABLE EMP
    FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "
    TRAILING NULLCOLS
    (ENO, ENAME, SAL);


    Thank you

    910575 wrote:
    Hello

    I load a CSV for emp table data using sql loader.
    I wrote the control as file below. How to run so that the data can be inserted into the emp table.

    Control file:
    DOWNLOAD THE DATA
    INFILE ' C:\VINOD\EMP_DATA. CSV'
    INSERT INTO THE TABLE EMP
    FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "
    TRAILING NULLCOLS
    (ENO, ENAME, SAL);

    Thank you

    bcm@bcm-laptop:~$ sqlldr 
    
    SQL*Loader: Release 11.2.0.1.0 - Production on Sun Jun 24 11:28:59 2012
    
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    
    Usage: SQLLDR keyword=value [,keyword=value,...]
    
    Valid Keywords:
    
        userid -- ORACLE username/password
       control -- control file name
           log -- log file name
           bad -- bad file name
          data -- data file name
       discard -- discard file name
    discardmax -- number of discards to allow          (Default all)
          skip -- number of logical records to skip    (Default 0)
          load -- number of logical records to load    (Default all)
        errors -- number of errors to allow            (Default 50)
          rows -- number of rows in conventional path bind array or between direct path data saves
                   (Default: Conventional path 64, Direct path all)
      bindsize -- size of conventional path bind array in bytes  (Default 256000)
        silent -- suppress messages during run (header,feedback,errors,discards,partitions)
        direct -- use direct path                      (Default FALSE)
       parfile -- parameter file: name of file that contains parameter specifications
      parallel -- do parallel load                     (Default FALSE)
          file -- file to allocate extents from
    skip_unusable_indexes -- disallow/allow unusable indexes or index partitions  (Default FALSE)
    skip_index_maintenance -- do not maintain indexes, mark affected indexes as unusable  (Default FALSE)
    commit_discontinued -- commit loaded rows when load is discontinued  (Default FALSE)
      readsize -- size of read buffer                  (Default 1048576)
    external_table -- use external table for load; NOT_USED, GENERATE_ONLY, EXECUTE  (Default NOT_USED)
    columnarrayrows -- number of rows for direct path column array  (Default 5000)
    streamsize -- size of direct path stream buffer in bytes  (Default 256000)
    multithreading -- use multithreading in direct path
     resumable -- enable or disable resumable for current session  (Default FALSE)
    resumable_name -- text string to help identify resumable statement
    resumable_timeout -- wait time (in seconds) for RESUMABLE  (Default 7200)
    date_cache -- size (in entries) of date conversion cache  (Default 1000)
    no_index_errors -- abort load on any index errors  (Default FALSE)
    
    PLEASE NOTE: Command-line parameters may be specified either by
    position or by keywords.  An example of the former case is 'sqlldr
    scott/tiger foo'; an example of the latter is 'sqlldr control=foo
    userid=scott/tiger'.  One may specify parameters by position before
    but not after parameters specified by keywords.  For example,
    'sqlldr scott/tiger control=foo logfile=log' is allowed, but
    'sqlldr scott/tiger control=foo log' is not, even though the
    position of the parameter 'log' is correct.
    

    alternative, you could always Read The Fine Manual

    http://docs.Oracle.com/CD/E11882_01/server.112/e22490/part_ldr.htm#i436326

  • SQL Loader control file (.ctl) given in table

    Hello

    I have a table 'region' in my schema called dss.
    SQL > desc region
    R_REGIONKEY
    R_NAME
    R_COMMENT
    I want to LOAD the data into this table of the region in a file called "region.tbl" located at d:\tpch\region.tbl, using a CONTROL file that is also on the the same place is to say d:\tpch\region.ctl.

    Region.tbl file contains few records. Recording of a SAMPLE of region.tbl is as follows:

    * 1 | AMERICA | HS ironic use, same request. s | *

    Region.CTL file contains the following lines to load data using sql loader:

    DOWNLOAD THE DATA
    INFILE'd:\tpch\region.tbl'
    IN THE REGION OF THE TABLE
    FIELDS TERMINATED BY ' |'
    * (R_REGIONKEY, R_NAME, R_COMMENT) *.

    so I go to the command prompt, navigate to the location of the above files and run the command:
    D:\TPCH > sqlldr control = region.ctl dss/dss = userid
    and get the following error:

    SQL * Loader-128: unable to start session
    ORA-01017: name of user and password invalid. connection refused

    I have the same table under the "system" user creation, but I get a different error with this that is:

    SQL * Loader-941: error when the table REGION describe statement
    ORA-04043: object REGION does not exist

    Using Oracle 11 g on my Windows XP.

    I'll appreciate the valuable suggestion.

    Thank you very much.

    Best regards
    Kam

    You can connect with dss/dss? For example, what

    sqlplus dss/dss
    

    If no, and you are sure that the name of username/password combination is correct, have you checked things like $ORACLE_SID - i.e. it points to the right database?

  • SQL Loader / WHAT clause / off swich? / bloated log files

    Hello everyone,

    I'm loading data using SQL-Loader very large source files. It all works very well.

    However, now, by using the WHEN clause (in the control file), I would like to only a very small subset of most load data. This also works very well...

    WHEN ARTICLECODE! '000000000000006769' =

    However, the log file becomes fully inflated with messages telling me to each record that does not have the WHEN clause...

    Record 55078: Discarded - failed all WHEN clauses.

    This becomes a problem because it slows down the process and creates large log files that eat upward of my disk space.

    There must be a simple command to allow me to disable the messages of thiese, but although I googled on it, I could not find it.

    Any ideas on this one? I don't know that it's simple.

    Best regards and many thanks,
    Alan Searle

    Try adding the SILENCE = RELEASES key sqlldr command

    Silent means - delete messages during execution (header, comments, errors, discards, partitions)

  • SQL * Loader: load data in the format MM/DD/YYYY HH: mi: SS PM

    Please advice how to load data in the format MM/DD/YYYY HH: mi: SS PM in an Oracle Table using SQL * Loader.

    -Should what format I give in the control file?
    -What would be the type of column to create the table to load data.

    Examples of data below;

    MM/DD/YYYY HH: MI: SS PM

    14:40:20 09/12/2012
    29/11/2011 11:23:12

    Thanks in advance
    Avinash

    Astr0 wrote:
    Hello Srini,

    I tried with the date of creation as DATE data type, but I had an error like

    ORA-01830: date format picture ends before converting entire input string
    CREATION_DATE               "TO_CHAR(TO_DATE(:CREATION_DATE,'MM/DD/YYYY HH:MI:SS AM'),'DD-MON-YYYY HH:MI:SS AM')",
    

    Try

    CREATION_DATE "to_Date(:CREATION_DATE,'yyyy-mm-dd hh:mi:ss AM')",
    

    Does that help? It is charging correctly in the timestamp column

    REDA

Maybe you are looking for