SQL Loader (how to cut data header)

Hello

[oracle 11g]


I got the following text file:
mod; DD.MM.YYYY; HH:MM:SS; aligned
src; "ptv "; "15.04.2012"; "10:47:49"
chs; "ISO8859-1"
ver; "V1.0"
ifv; "V1.0"
dve; "V1.0"
fft; "LIO"
tbl; MENGE_FGR
atr; BASIS_VERSION; FGR_NR; FGR_TEXT
frm; num[9.0]; num[5.0]; char[40]
rec;        122;     8; "VVZ"    
rec;        123;     18; "VHZ"
rec;        124;     13; "VTZ"    
Now I am interested in the column TBL and ATR and follwing rawdata

Can you see a way to automatically create the MENGE_FR table with columns BASIS_VERSION. FGR_NR; FGR_TEST and column types num, num, char and insert raw data below?

PS:OK, it's mysql... .so I need to convert this sql first. So, you should see num as number.


THX in advance Thorsten

Published by: Thorsten on 16.05.2013 07:30

Published by: Thorsten on 16.05.2013 07:32

There are various ways you could do this. I demonstrated one of the methods below. I created a table with two columns, and then use SQL * Loader to load the data from the text file in these two columns. Skip header lines is optional. You can also use a portal instead, if the text file is located on your server, not your client. I then used some PL/SQL to create and run 'create table' and 'insert '. It's just a startup code. You will need to make changes to manage other types of data, and others who were not in the example you provided, but it should give you the general idea.

SCOTT@orcl_11gR2> host type text_file.dat
mod; DD.MM.YYYY; HH:MM:SS; aligned
src; "ptv "; "15.04.2012"; "10:47:49"
chs; "ISO8859-1"
ver; "V1.0"
ifv; "V1.0"
dve; "V1.0"
fft; "LIO"
tbl; MENGE_FGR
atr; BASIS_VERSION; FGR_NR; FGR_TEXT
frm; num[9.0]; num[5.0]; char[40]
rec;        122;     8; "VVZ"
rec;        123;     18; "VHZ"
rec;        124;     13; "VTZ"

SCOTT@orcl_11gR2> host type test.ctl
options(skip=7)
load data
infile text_file.dat
into table tbl
(col1 terminated by ';',
col2 terminated by x'0a')

SCOTT@orcl_11gR2> create table tbl
  2    (col1  varchar2(4),
  3     col2  varchar2(60))
  4  /

Table created.

SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test.ctl log=test.log

SQL*Loader: Release 11.2.0.1.0 - Production on Thu May 16 13:44:24 2013

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

Commit point reached - logical record count 6

SCOTT@orcl_11gR2> select * from tbl
  2  /

COL1 COL2
---- ------------------------------------------------------------
tbl   MENGE_FGR
atr   BASIS_VERSION; FGR_NR; FGR_TEXT
frm   num[9.0]; num[5.0]; char[40]
rec          122;     8; "VVZ"
rec          123;     18; "VHZ"
rec          124;     13; "VTZ"

6 rows selected.

SCOTT@orcl_11gR2> declare
  2    v_tab   varchar2(30);
  3    v_atr   varchar2(32767);
  4    v_frm   varchar2(32767);
  5    v_sql   varchar2(32767);
  6    v_cols  number;
  7    v_next  varchar2(32767);
  8  begin
  9    select col2 into v_tab from tbl where col1 = 'tbl';
 10    select col2 || ';' into v_atr from tbl where col1 = 'atr';
 11    select col2 || ';' into v_frm from tbl where col1 = 'frm';
 12    v_sql := 'CREATE TABLE ' || v_tab || ' (';
 13    select regexp_count (col2, ';') + 1 into v_cols from tbl where col1 = 'atr';
 14    for i in 1 .. v_cols loop
 15      v_sql := v_sql || substr (v_atr, 1, instr (v_atr, ';') - 1) || ' ';
 16      v_next := substr (v_frm, 1, instr (v_frm, ';') - 1);
 17      v_next := replace (v_next, '[', '(');
 18      v_next := replace (v_next, ']', ')');
 19      v_next := replace (v_next, '.', ',');
 20      v_next := replace (v_next, 'num', 'number');
 21      v_next := replace (v_next, 'char', 'varchar2');
 22      v_sql := v_sql || v_next || ',';
 23      v_atr := substr (v_atr, instr (v_atr, ';') + 1);
 24      v_frm := substr (v_frm, instr (v_frm, ';') + 1);
 25    end loop;
 26    v_sql := rtrim (v_sql, ',') || ')';
 27    dbms_output.put_line (v_sql);
 28    execute immediate v_sql;
 29    for r in (select col2 from tbl where col1 = 'rec') loop
 30      v_sql := 'INSERT INTO ' || v_tab || ' VALUES (''';
 31      v_sql := v_sql || replace (replace (r.col2, ';', ''','''), '"', '');
 32      v_sql := v_sql || ''')';
 33      dbms_output.put_line (v_sql);
 34      execute immediate v_sql;
 35    end loop;
 36  end;
 37  /
CREATE TABLE  MENGE_FGR ( BASIS_VERSION  number(9,0), FGR_NR  number(5,0),
FGR_TEXT  varchar2(40))
INSERT INTO  MENGE_FGR VALUES ('        122','     8',' VVZ')
INSERT INTO  MENGE_FGR VALUES ('        123','     18',' VHZ')
INSERT INTO  MENGE_FGR VALUES ('        124','     13',' VTZ')

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> describe menge_fgr
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 BASIS_VERSION                                      NUMBER(9)
 FGR_NR                                             NUMBER(5)
 FGR_TEXT                                           VARCHAR2(40)

SCOTT@orcl_11gR2> select * from menge_fgr
  2  /

BASIS_VERSION     FGR_NR FGR_TEXT
------------- ---------- ----------------------------------------
          122          8  VVZ
          123         18  VHZ
          124         13  VTZ

3 rows selected.

Tags: Database

Similar Questions

  • SQL * Loader does not import data

    Hi all -

    I have a very basic package which should load data from a file delimited by tabs.  My problem is that when I run my package, no data is loaded. Although the correct number of records is created (based on relaxation of the table).  All records contain no data.

    OPTIONS (skip = 1, errors = 10, lines = 10000, direct = True)

    DOWNLOAD THE DATA

    INFILE "C:\ECOMMERCE\VFT\Marin\inbound\DSGSiteCatalystPassbackKeywords.csv" "str"\n"

    BADFILE "C:\ECOMMERCE\MFT\NxtGen_Catalog_Int\ErrorFiles\MARIN_DSG_KEYWORDS.bad."

    DISCARDFILE 'C:\ECOMMERCE\MFT\NxtGen_Catalog_Int\ErrorFiles\MARIN_DSG_KEYWORDS.dsc '.

    IN THE TABLE "ETL_STAGE". "" MARIN_KEYWORD ".

    ADD

    EVALUATE CHECK_CONSTRAINTS

    "FIELDS TERMINATED BY ' 09 X."

    TRAILING NULLCOLS

    (

    MARIN_KEYWORD_ID,

    KEYWORD,

    BUSINESS_DATE,

    EDITOR,

    ACCOUNT,

    CAMPAIGN,

    AD_GROUP,

    TYPE CHAR (100000),

    DESTINATION_URL,

    UNIQUE_ID,

    PUB_ID,

    PRINT,

    CLICKS,

    PUB_COST,

    ATTRIBUTED_CONVERSIONS_CONV,

    CLICK_PATH_CONV,

    LAST_CLICK_CONV,

    EMAIL_SIGNUPS_CONV,

    SCORECARD_SIGNUPS_CONV,

    STORE_LOCATOR_PAGE_CONV

    )

    My table creation script is:

    CREATE THE TABLE ETL_STAGE. MARIN_KEYWORD

    (

    MARIN_KEYWORD_ID VARCHAR2 (1000 BYTE),

    KEYWORD VARCHAR2 (1000 BYTE).

    BUSINESS_DATE VARCHAR2 (200 BYTE),

    EDITOR VARCHAR2 (1000 BYTE),

    ACCOUNT VARCHAR2 (1000 BYTE),

    CAMPAIGN VARCHAR2 (1000 BYTE),

    AD_GROUP VARCHAR2 (1000 BYTE),

    TYPE VARCHAR2 (1000 BYTE),

    DESTINATION_URL VARCHAR2 (1000 BYTE),

    UNIQUE_ID VARCHAR2 (1000 BYTE),

    PUB_ID VARCHAR2 (1000 BYTE),

    VARCHAR2 (1000 BYTE) PRINT,

    VARCHAR2 (1000 BYTE) CLICKS,

    PUB_COST VARCHAR2 (1000 BYTE),

    ATTRIBUTED_CONVERSIONS_CONV VARCHAR2 (1000 BYTE),

    CLICK_PATH_CONV VARCHAR2 (1000 BYTE),

    LAST_CLICK_CONV VARCHAR2 (1000 BYTE),

    EMAIL_SIGNUPS_CONV VARCHAR2 (1000 BYTE),

    SCORECARD_SIGNUPS_CONV VARCHAR2 (1000 BYTE),

    STORE_LOCATOR_PAGE_CONV VARCHAR2 (1000 BYTE),

    IMEX_LOG_REFERENCE_ID VARCHAR2 (1000 BYTE),

    DATE_ADDED DATE DEFAULT SYSDATE NOT NULL,.

    ADDED_BY VARCHAR2 (50 BYTES) BY DEFAULT USER NOT NULL,.

    DATE_LAST_MODIFIED DATE DEFAULT SYSDATE NOT NULL,.

    MODIFIED_BY VARCHAR2 (50 BYTES) BY DEFAULT USER NOT NULL,.

    RECORD_STATUS VARCHAR2 (1 BYTE) DEFAULT 'A' NOT NULL

    )

    TABLESPACE ECOM_DATA

    PCTUSED 0

    PCTFREE 10

    INITRANS 1

    MAXTRANS 255

    STORAGE)

    64K INITIALS

    ACCORDING TO 1 M

    MINEXTENTS 1

    MAXEXTENTS UNLIMITED

    PCTINCREASE 0

    DEFAULT USER_TABLES

    )

    LOGGING

    NOCOMPRESS

    NOCACHE

    NOPARALLEL

    MONITORING;

    The log displays the following text:

    SQL * Loader: release 11.2.0.2.0 - Production on Thu Jun 25 14:31:35 2015

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

    Control file: C:\ECOMMERCE\MFT\NxtGen_Catalog_Int\SQLLoaderScripts\MARIN_DSG_CREATIVES.ctl

    Data file: C:\ECOMMERCE\VFT\Marin\inbound\DSGSiteCatalystPassbackCreatives.csv

    Bad leadership: C:\\ECOMMERCE\MFT\NxtGen_Catalog_Int\ErrorFiles\MARIN_DSG_CREATIVES.bad

    Delete the file: C:\ECOMMERCE\MFT\NxtGen_Catalog_Int\ErrorFiles\MARIN_DSG_CREATIVES.dsc

    (Allow all releases)

    Number of loading: ALL

    Number of jump: 10

    Authorized errors: 50

    Link table: 64 lines, maximum of 256000 bytes

    Continuation of the debate: none is specified

    Path used: classics

    Table 'ETL_STAGE '. "" MARIN_CREATIVE ", loaded from every logical record.

    Insert the option in effect for this table: APPEND

    TRAILING NULLCOLS option in effect

    Column Position Len term Encl. Datatype name

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

    CREATIVE_ID PRIME * WHT O(") CHARACTER

    The maximum field length is 100,000

    HEADLINE THEN * CHARACTER O(") WHT

    BUSINESS_DATE NEXT * CHARACTER O(") WHT

    The SQL string for the column: 'TRIM(:BUSINESS_DATE) '.

    DESCRIPTION_LINE_1 NEXT * CHARACTER O(") WHT

    DESCRIPTION_LINE_2 NEXT * CHARACTER O(") WHT

    DISPLAY_URL NEXT * CHARACTER O(") WHT

    DESTINATION_URL NEXT * WHT O(") CHARACTER

    The maximum field length is 100,000

    EDITOR NEXT * CHARACTER O(") WHT

    THEN THE CAMPAIGN * CHARACTER O(") WHT

    AD_GROUP NEXT * CHARACTER O(") WHT

    UNIQUE_ID NEXT * CHARACTER O(") WHT

    PUB_ID NEXT * CHARACTER O(") WHT

    PRINT NEXT * CHARACTER O(") WHT

    The SQL string for the column: "replace (: print, ',',") "."

    CLICK ON NEXT * CHARACTER O(") WHT

    The SQL string for the column: "replace (: CLICKS, ',',") "."

    ATTRIBUTED_CONVERSIONS_CONV NEXT * CHARACTER O(") WHT

    CLICK_PATH_CONV NEXT * CHARACTER O(") WHT

    LAST_CLICK_CONV NEXT * CHARACTER O(") WHT

    EMAIL_SIGNUPS_CONV NEXT * CHARACTER O(") WHT

    SCORECARD_SIGNUPS_CONV NEXT * CHARACTER O(") WHT

    STORE_LOCATOR_PAGE_HITS_CONV NEXT * CHARACTER O(") WHT

    IMEX_LOG_REFERENCE_ID NEXT * CHARACTER O(") WHT

    Why WHT, showing when I use tabs?

    In addition, why is not display all the data in the files?

    NLS_CHARACTERSET WE8ISO8859P1
  • How to cut the header in three lines in OBIEE10g?

    Hello

    Can someone help by dividing header in three lines...

    I can able to divide into two rows by using the table and column names custom, but unable to divide it into 3 lines.

    My requirement is
    Row1) Table Name (customised Name)
    row2) column name (custom)
    name of column row3)

    Please tell me if it is possible in OBIEE10g or not. I use as oracle 10g database.


    Thank you
    Pavan

    Published by: 911761 on February 17, 2012 04:21

    Hi Pavan,

    You can try to display your name subcolumn within the column header section by adding a line break between your column name and column name. that is in your column heading specify the text as - column name < br / > the name of the column. The br tag will force the column displayed in another line. In addition, to make this work you must add this entry in your instanceconfig.xml file.

    < HardenXSS > false < / HardenXSS >

    See this link for more on the above tag:
    http://gerardnico.com/wiki/dat/OBIEE/hardenxss

    Thank you

  • How to cut data in pieces, have been collected by DAQ assistant?

    like the image below, the data were won by a random number generator in a loop for a vector that contains 10 points each time

    scrip MATLAB to process will be. now, I want to get the data by the DAQ assistant

    but I can't my goal, can someone help me?

    You could say the DAQ Assistant, to return only the number of samples to be processed.  I'm still lost as to what exactly you are looking for.

  • SQL Loader, CLOB, delimited fields

    Hello.

    I have to load using SQL Loader of csv file data into a table, a field is of type CLOB.

    Here's how ctl file looked like at the beginning:

    UNRECOVERABLE
    DOWNLOAD THE DATA
    INFILE «.\csv_files\TSH_DGRA.csv '.
    BADFILE «.\bad_files\TSH_DGRA.bad '.
    DISCARDFILE «.\dsc_files\TSH_DGRA.dsc '.
    ADD
    IN THE TSH_DGRA TABLE
    FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "
    TRAILING NULLCOLS
    (
    ID_OBJ_TSHD,
    PR_ZOOM_TSHD,
    PR_GRID_TSHD,
    PR_ELMGR_TSHD TANK (4000) OPTIONALLY ENCLOSED BY '< clob >' AND ' < / clob > ',
    PR_ALRMGR_TSHD TANK (4000) OPTIONALLY ENCLOSED BY '< clob >' AND ' < / clob > '
    )


    The problems are the fields PR_ELMGR_TSHD and PR_ALRMGR_TSHD (CLOB in the table TSH_DGRA). Until which data should be loaded into CLOB fields are at least 4000 characters, it works very well, but what do I do if I want to load data that is older of 4000 characters?

    If found on the link: [http://download.oracle.com/docs/cd/B14117_01/server.101/b10825/ldr_loading.htm#i1006803] which a sentence says:

    "SQL * Loader by default 255 bytes when moving CLOB data, but you can specify a value of up to 2 gigabytes." For a field bounded, if a length is specified, this length is used as a maximum. If no maximum is specified, it uses default 255 bytes. For a CHAR field that is bounded and is also greater than 255 bytes, you must specify a maximum length. (See TANK for more information on the CHAR data type".

    So, my question is, how specify "up to 2 GB" so that text says? I can't use the CHAR data type because it is limited to 4,000 characters. And I have to load about 60000 characters. I also can't use technique where all each CLOB field data in separate files.

    Simply specify the expected maximum size:

    ....
    PR_ELMGR_TSHD TANK (100000), POSSIBLY ENCLOSED BY ""AND"."
    PR_ALRMGR_TSHD TANK (1000000), OPTIONALLY ENCLOSED BY '... « ET ». »
    )

    The CHARIOT (1000000) will allow SQLLDR to manage up to 1000000 bytes of input text.

  • 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

  • How to handle multiple formats of date to the same date field in SQL * Loader

    Dear all,

    I have a requirement where I need to get data from a text file and even insert into the oracle table.

    I'm using SQL * Loader to fill data from the text file in my table.

    The file has an area where I expect to date data date in different formats, such as MON/dd/yyyy mon/dd/yyyy mon/dd/yyyy, dd/mm/yyyy, DD/month/yyyy.

    When you use SQL * Loader, I can see loading fails for records where we have formats such as LUN/jj/aaaa, Mon/dd/yyyy, DD/month/yyyy.

    Is it possible in SQL * Loader where we can mention all these date formats so that data from that date should go smoothly in the underlying date column in the table.

    Receive your answer on that.

    Thank you
    Madhu K.

    I think following could be the solution to your problem:

    Suppose if you have data from four different date formats, you need to load the data into four different tables by running SQL * Loader four times and each time specify other date format in the control file whose data to load, and then at the end, merge data from these four different tables using the UNION clause.

    Elya

  • Associating a header for his record in detail record in SQL Loader

    I have a SQL loader script that loads the data in 2 separate tables, a table containing the header and one giving details. Once the charge is completed there is no way of knowing what element is associated with his header.
    Is there a way to associate a header record with its corresponding details?

    Published by: 934858 on May 16, 2012 16:49

    >
    2. the header and detail have the item number in the column
    >
    So I expect that 'Article number' provides the association.

    If this isn't the case, then show the header and detail DDL table and some sample data and remember where is the problem.

    This is why I am asking about (and you do not answer) how data loading; a single file or two, flat or hierarchical, files etc. to see how your sql * control of loading script dealt with data.

  • Import data... Wizard creates the file SQL Loader ctl with columns out of order

    4.1.1.19 SQL Developer version. Connected to Oracle XE to test this.

    I'm trying to understand what the problem with the data in my import file when finally, I realize that the Import Wizard of data did not care how I traced the columns at all. The ctl SQL Loader file generated by the Wizard expects that the columns of data in my file to match the order that they appear in the definition of the table and not how they have been mapped in the wizard. Manually edit the ctl file is a workaround. Has anyone else seen elsewhere?

    I see that this is a bug.

  • SQL Loader loading data into two Tables using a single CSV file

    Dear all,

    I have a requirement where in I need to load the data into 2 tables using a simple csv file.

    So I wrote the following control file. But it loads only the first table and also there nothing in the debug log file.

    Please suggest how to achieve this.

    Examples of data

    Source_system_code,Record_type,Source_System_Vendor_number,$vendor_name,Vendor_site_code,Address_line1,Address_line2,Address_line3

    Victor, New, Ven001, Vinay, Vin001, abc, def, xyz

    Control file script

    ================

    OPTIONS (errors = 0, skip = 1)
    load data
    replace
    in the table1 table:
    fields ended by ',' optionally surrounded "" "
    (
    Char Source_system_code (1) POSITION "ltrim (rtrim (:Source_system_code)),"
    Record_type tank "ltrim (rtrim (:Record_type)),"
    Source_System_Vendor_number tank "ltrim (rtrim (:Source_System_Vendor_number)),"
    $vendor_name tank "ltrim (rtrim (:Vendor_name)),"
    )
    in the Table2 table
    1 = 1
    fields ended by ',' optionally surrounded "" "
    (
    $vendor_name tank "ltrim (rtrim (:Vendor_name)),"
    Vendor_site_code tank "ltrim (rtrim (:Vendor_site_code)),"
    Address_line1 tank "ltrim (rtrim (:Address_line1)),"
    Address_line2 tank "ltrim (rtrim (:Address_line2)),"
    Address_line3 tank "ltrim (rtrim (:Address_line3)).
    )

    the problem here is loading into a table, only the first. (Table 1)

    Please guide me.

    Thank you

    Kumar

    When you do not provide a starting position for the first field in table2, it starts with the following after a last referenced in table1 field, then it starts with vendor_site_code, instead of $vendor_name.  So what you need to do instead, is specify position (1) to the first field in table2 and use the fields to fill.  In addition, he dislikes when 1 = 1, and he didn't need anyway.  See the example including the corrected below control file.

    Scott@orcl12c > test.dat TYPE of HOST

    Source_system_code, Record_type, Source_System_Vendor_number, $vendor_name, Vendor_site_code, Address_line1, Address_line2, Address_line3

    Victor, New, Ven001, Vinay, Vin001, abc, def, xyz

    Scott@orcl12c > test.ctl TYPE of HOST

    OPTIONS (errors = 0, skip = 1)

    load data

    replace

    in the table1 table:

    fields ended by ',' optionally surrounded "" "

    (

    Char Source_system_code (1) POSITION "ltrim (rtrim (:Source_system_code)),"

    Record_type tank "ltrim (rtrim (:Record_type)),"

    Source_System_Vendor_number tank "ltrim (rtrim (:Source_System_Vendor_number)),"

    $vendor_name tank "ltrim (rtrim (:Vendor_name)).

    )

    in the Table2 table

    fields ended by ',' optionally surrounded "" "

    (

    source_system_code FILL (1) POSITION.

    record_type FILLING,

    source_system_vendor_number FILLING,

    $vendor_name tank "ltrim (rtrim (:Vendor_name)),"

    Vendor_site_code tank "ltrim (rtrim (:Vendor_site_code)),"

    Address_line1 tank "ltrim (rtrim (:Address_line1)),"

    Address_line2 tank "ltrim (rtrim (:Address_line2)),"

    Address_line3 tank "ltrim (rtrim (:Address_line3)).

    )

    Scott@orcl12c > CREATE TABLE table1:

    2 (Source_system_code VARCHAR2 (13),)

    3 Record_type VARCHAR2 (11),

    4 Source_System_Vendor_number VARCHAR2 (27),

    5 $vendor_name VARCHAR2 (11))

    6.

    Table created.

    Scott@orcl12c > CREATE TABLE table2

    2 ($vendor_name VARCHAR2 (11),)

    3 Vendor_site_code VARCHAR2 (16).

    4 Address_line1 VARCHAR2 (13),

    5 Address_line2 VARCHAR2 (13),

    Address_line3 6 VARCHAR2 (13))

    7.

    Table created.

    Scott@orcl12c > HOST SQLLDR scott/tiger CONTROL = test.ctl DATA = test.dat LOG = test.log

    SQL * Loader: release 12.1.0.1.0 - Production on Thu Mar 26 01:43:30 2015

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

    Path used: classics

    Commit the point reached - the number of logical records 1

    TABLE1 table:

    1 row loaded successfully.

    Table TABLE2:

    1 row loaded successfully.

    Check the log file:

    test.log

    For more information on the charge.

    Scott@orcl12c > SELECT * FROM table1

    2.

    RECORD_TYPE SOURCE_SYSTEM_VENDOR_NUMBER $VENDOR_NAME SOURCE_SYSTEM

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

    Victor Ven001 new Vinay

    1 selected line.

    Scott@orcl12c > SELECT * FROM table2

    2.

    $VENDOR_NAME VENDOR_SITE_CODE ADDRESS_LINE1 ADDRESS_LINE2 ADDRESS_LINE3

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

    Vinay Vin001 abc def xyz

    1 selected line.

    Scott@orcl12c >

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

  • 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

  • SQL Loader failed to load the same source sometimes data file

    I meet different types of data, loading errors when you try to load data. What makes it really annoying, is that I'm not able to identify the real culprit since the success of load depends on the amount of lines in the source data file but not its content. I use dataset Toad export feature to create delimited data set. When I decided to take the first 50 lines then succeeds data to load into the target table. When I decide to take the first 150 lines then the data to load into the target table fails indicating that:
    Record 13: Rejected - Error on table ISIKUD, column SYNLAPSI.
    ORA-01722: invalid number
    I can see .bad file that the same line has been loaded successfully when the data file that contains 50 rows was used. The content has no column for this particular row is NULL (no chain).
    I suspect that the toad generates faulty delimited text file when taking 150 lines. File data for reasons of confidentiality, I can't show. What can I do? How can we all further investigate this problem? Size of the array that must be loaded by SQL Loader is almost 600 MB. I use Windows XP.

    Published by: totalnewby on June 30, 2012 10:17

    I do not believe that customer sqlloader 11g allows you to load a 10g database. You can run sqlldr on the server of database 10g itself? PL also post the rest I asked information

    HTH
    Srini

  • Ctl SQL Loader Date Format file

    Hi, I have a source file with the format of date as * [23:02:2012] [04:04:50:579] *, how can I remove ' [' and ']' and load it as 23:02:2012 04:04:50:579.

    I tried like

    CallSetupTime DATE completed by ',' ENCLOSED BY '[' AND '] ' HH24MISSFFFFF ' DD/MM/YYYY "

    BUT did not work. Please help me. Thank you very much..

    Kind regards
    Sam

    I suggest to use the correct data type. See here: sql loader timestamp

    for example CallSetupTime TIMESSTAMP "[JJ] [HH24:MI:SS:FFF].

    the format must exactly match the format of your data. Maybe it isa best format for the second millis, see the mentioned thread and formats the docs on the stamp

    concerning

  • Encapsulate data problems when loading with sql loader

    Hi all

    I use sql loader to load data into a flat file HP UNIX.

    I find the fi the NUMBER data type or date type get wraped to the new line, the control file triggered errors.

    The data looks like to (field dilimiter is |, record dilimter is ~):

    1 A87CCH | 1 A87CCH | PLAN_ACCOUNT_PROMOTION | HIR6A-1 | 20100706 06:06:24 | 1 DNE1 | DC?
    2010.7 FY1011 Promoiton | 1 A87AW0 | 1 HJEZE | Private | 20100730 00:00:00 | 00 20100710
    : 00:00 | 0 | Completed | 20100730 00:00:00 | 20100710 00:00:00 | 0 | 1 4A6PKP | TFMAAI | N
    | 0 | 0 | 0 | 0 | 0 | 0 | 1 4A6PKP | Approved | 1 8U4E-163 | 00:00:20110630 00 |
    20100708 01:45:35 | 20100707 00:00:00 | -1||| 0 | 9000 | 0 | 0 ||| 100. N | 0 | 0 | 0 | 0
    | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | N | 20110426 04:01:34 | 1 8U4E-163 | 0|||||||||
    ||||| ~


    The control file looks like:

    OPTIONS (ERRORS = 1000, DIRECT = TRUE, PARALLEL = TRUE, DATE_CACHE = 5000, discardmax = 50)
    UNRECOVERABLE
    load data
    INFILE ' / home/bs7822/leon/leon.dat' "str" ~ "»
    BADFILE ' / home/bs7822/leon/leon.bad'
    DISCARDFILE ' / home/bs7822/leon/leon.discard'
    ADD THE LEON_123456 TABLE
    FIELDS TERMINATED BY ' | '. SURROUNDED OF POSSIBLY "" "
    TRAILING NULLCOLS
    (
    X_INTERFACED_DT EXPRESSION "to_date (replace (replace (: X_INTERFACED_DT_BF, chr (10),"), Chr (13), "), 'YYYYMMDD hh24:mi:ss')", "
    X_INTERFACED_DT_BF boundfiller,
    EXTERNAL DECIMAL X_ACCRUAL_AMT,
    X_PLAN_SHIPMENT_PATTERN_ID TANK (90)
    )

    I think that replace it can treat the wrapped date. But I want to know if we can find a faster or easier way to conquer this topic since the beginning.

    Best regards

    Leon

    user12064076 wrote:
    Thank you for your response. But how to ensure that a record is in a single line? For example, to unload data with coil?

    The table has more than 100 columns.

    Best regards
    Leon

    UH... which guarantee is implemented by anyone or anything that generates the data in the first place.
    for example if I am extracting data to CSV for a customer or another application, making sure that it is 1 card per line with delimiters known etc.

    What is your own code that produces the data in the first place? If so, how are you to produce? With large amounts of data I wouldn't do it with SQL * Plus spool command, but I do with UTL_FILE within PL/SQL, or generating data in a file CLOB and spell the CLOB in a go using one of the CLOB methods available writing files.

Maybe you are looking for