sqlldr when clause with double quotes

Hi all

I have a requirement to load the .dat data in two tables based on 2 conditions.

EMP.dat

"HH", "21 JULY 2014", 2 320.00.

"D", "E1", "London", 120.00

"D", "emp2', 'Read', 200.00

'FF', 2

Control file

OPTIONS (ERRORS = 100)

DOWNLOAD THE DATA

INFILE ' / home/interface/EMP.dat'

REPLACE

IN TABLE XX. XX_EMP_CONTROL

WHEN (1) = 'HH '.

FIELDS ENDED BY ',' OPTIONALLY SURROUNDED "" "

TRAILING NULLCOLS

(

RUN_NUMBER POSITION (4),

DATE OF PAYMENT_RUN_DATE,

RECORD_COUNT,

FILE_TOTAL

)

IN TABLE XX. XX_EMP_DETAIL

WHEN (1) = A '

FIELDS ENDED BY ',' OPTIONALLY SURROUNDED "" "

TRAILING NULLCOLS

(

EMP_NAME POSITION (3),

LOCATION,

AMOUNT

)

When I run the program sqlldr, no data is transferred. If I remove the quotes in the data file, the data from loading successfully. Could someone guide me how I can read these data please?

Thank you

sheebs

Scott@orcl12c > emp.dat TYPE of HOST

"HH", "21 JULY 2014", 2 320.00.

"D", "E1", "London", 120.00

"D", "emp2', 'Read', 200.00

'FF', 2

Scott@orcl12c > test.ctl TYPE of HOST

OPTIONS (ERRORS = 100)

DOWNLOAD THE DATA

INFILE 'EMP.dat '.

REPLACE

IN THE XX_EMP_CONTROL TABLE

WHEN run_number = 'HH '.

FIELDS ENDED BY ',' OPTIONALLY SURROUNDED "" "

TRAILING NULLCOLS

(

RUN_NUMBER,

DATE OF PAYMENT_RUN_DATE,

RECORD_COUNT,

FILE_TOTAL

)

IN THE XX_EMP_DETAIL TABLE

WHEN fill1 = has '

FIELDS ENDED BY ',' OPTIONALLY SURROUNDED "" "

TRAILING NULLCOLS

(

POSITION FILLING fill1 (1),

EMP_NAME,

LOCATION,

AMOUNT

)

Scott@orcl12c > xx_emp_control CREATE TABLE

2 (run_number VARCHAR2 (3),)

3 payment_run_date DATE,

4 record_count NUMBER,

5 file_total NUMBER)

6.

Table created.

Scott@orcl12c > xx_emp_detail CREATE TABLE

2 (emp_name VARCHAR2 (15),)

3 location VARCHAR2 (15).

4 amount NUMBER)

5.

Table created.

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

SQL * Loader: release 12.1.0.1.0 - Production on Mon Jul 21 10:46 2014

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

Path used: classics

Commit the point reached - the number of logical records 4

Table XX_EMP_CONTROL:

1 row loaded successfully.

Table XX_EMP_DETAIL:

2 rows loaded successfully.

Check the log file:

test.log

For more information on the charge.

Scott@orcl12c > SELECT * FROM xx_emp_control

2.

RUN PAYMENT_RUN_DAT RECORD_COUNT FILE_TOTAL

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

Monday, July 21, 2014 2 HH 320

1 selected line.

Scott@orcl12c > SELECT * FROM xx_emp_detail

2.

EMP_NAME PLACE AMOUNT

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

London E1 120

EMP2 reading 200

2 selected lines.

Tags: Database

Similar Questions

  • ODI to Essase Metadata - formula with double quote error.

    Hi all

    We update Essbase Metadata ODI. We have sql table where all requirements of columns for metadata download is here.

    The formula is to have "quotes" in the formula column.

    When he get transferred to Essbase. The double quotes are not getting updated and so the formula is seen as loaded error formula.

    So how do you remedy this? Please suggest.

    Thank you
    Alex keny.

    "' Try to use something like -" formula or member name \ ".

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • CSV with double quotes

    Hello

    I had tough time trying to figure out how to read a CSV with quotes, I need to read a csv file in order to fill out a worksheet.

    I am attaching a sample csv file to display the type of file, that I'm trying.

    Thank you

    After inspection, you're right, it's a trick question.  You need commas that follow an even number of quotes for separators.  Since my previous statement was not converted, I assume that you have an earlier version of LV, so I have attached an example of 8.6.  You can get rid of the quotes if you like (exercise for the reader).

  • replace a single quote with the double quotes with the function replace

    I work with one apex page, which contains a text as a filter box. If I put a single quote and find then I get the error message saying that parse error.

    For this, I want to replace one single quotation mark with double quotes, so this should be perfect. and apex should show the result.

    A allow the query to the same which will replace the single quote with double quotes.

    Published by: Santhosh Kumar T 15 Sep 2008 05:13

    If it was confusing... Try the less confusion (according to you)! ...

    Select Replace ("ab" | ") "|' it," ',' "') twice;"

  • remove the double quotes in a value

    DB version: 10g / 11g

    Table customer_address
    column: adresse_rue
    data in the example: 'MLK 1234 drive '.
    'dr North 150, st #600'
    'o Henry 15678 dr.

    Update: reader of MLK 1234
    150 north dr, st #600
    Dr. Henry o 15678

    I'm looking to remove the double quotes (""), if this is the first and the last character.

    It would be nice to get these lines with values begins and ends with double-quotes


    Thank you for your time

    Published by: nydba on March 22, 2012 09:02

    One way:

    with a as (select '"1234 MLK drive"' x from dual
               union select '5678 JFK drive' from dual)
    select a.*,substr(x,2,length(x)-2) from a
    where x like '"%"';
    
    X                SUBSTR(X,2,LENGTH(X)-2)
    ---------------- -----------------------
    "1234 MLK drive" 1234 MLK drive        
    

    There is probably a more efficient way with regular expressions.

  • Replace the string, each value should double quotes around it

    How can I replace this basic string with double quotes around each value?

    dog, cat, john, mark

    I would like to:

    'dog', 'cat', 'john', 'brand '.

    Thank you

    -weStsIdE

    Hello

    I answered my own question. Well nice for someone else. The function ListQualify will insert what you need before and after each element of individual list.

    Actually powerful enough that you can just insert double quotation marks, for example around channels and leave intact numeric values.

    -weStSidE

  • double quotes in query

    Hello

    I have the last query executed using the function ora_sql_txt (sql_text) for some auditing.
    Now on a server, I get the last query as

    Select columnname "schemaname." "' TableName ';
    That is to say that get double quote as extra.

    Although on some I get without double quotes
    Select the schemaname.tablename columnname;

    Is there a setting in oracle for this.

    I use oracle 10g

    Sicard

    When included in double quotes, names of objects must be used in the same case, in which they were created.

    Table f. ex. TEST created as 'Test' are not accessible as 'test' or 'TEST' and so on. It must be consulted as "Test" only.

  • How to sqlldr, i.e. load data between double quotes?

    How to load/sqlldr double quota data? What should be the control look like file?

    DOWNLOAD THE DATA
    INFILE *.
    Add
    IN THE ROUTE_TIME TABLE
    FIELDS ENDED BY ',' OPTIONALLY ENCLOSED "" "
    TRAILING NULLCOLS
    (BLADE_ID TANK NULLIF (BLADE_ID = WHITE),
    ROUTE_CODE TANK NULLIF (ROUTE_CODE = WHITE),
    STARTTIME TANK NULLIF (STARTTIME = WHITES),
    ENDTIME TANK NULLIF (ENDTIME = WHITES),
    ROUTE_CODE_DAY1 TANK NULLIF (ROUTE_CODE_DAY1 = WHITE),
    ROUTE_CODE_DAY2 TANK NULLIF (ROUTE_CODE_DAY2 = WHITE),
    ROUTE_CODE_DAY3 TANK NULLIF (ROUTE_CODE_DAY3 = WHITE),
    ROUTE_CODE_DAY4 TANK NULLIF (ROUTE_CODE_DAY4 = WHITE),
    ROUTE_CODE_DAY5 TANK NULLIF (ROUTE_CODE_DAY5 = WHITE),
    ROUTE_CODE_DAY6 TANK NULLIF (ROUTE_CODE_DAY6 = WHITE),
    ROUTE_CODE_DAY7 TANK NULLIF (ROUTE_CODE_DAY7 = WHITE),
    ACTIVE_DATE DATE "YYYY-MM-DD HH24:MI:SS" NULLIF (ACTIVE_DATE = WHITE).
    TERMINATE_DATE DATE "YYYY-MM-DD HH24:MI:SS" NULLIF (TERMINATE_DATE = WHITE).
    CREATE_ON DATE "YYYY-MM-DD HH24:MI:SS" NULLIF (CREATE_ON = WHITE).
    CREATE_BY TANK NULLIF (CREATE_BY = BLANKS))
    begindata
    'BLADE_001', 'A_TOP_DEST',' 00:00:00 ',' 00:30:00 ', 'ALEGWD10P0A', 'ALEGWD10P0A', 'ALEGWD10P0A', 'ALEGWD10P0A', 'ALEGWD10P0A', 'ALEGSA10P0A', 'ALEGSU10P0A', ' 01-SEP-2007 00:00:00 "," "," 01-SEP-2007 13:10:35 "," SYSTEM ".

    Of course the above is false, could just a tell me what is the problem.

    I talked about http://download-uk.oracle.com/docs/cd/A97630_01/server.920/a96652/ch05.htm#1005624, but I'm not able to interpret the syntax correctly.

    Thank you

    The format mask 'MM-DD-YYYY HH24:MI:SS' does not match with the data "01-SEP-2007 00:00:00.

  • Fields Publisher report with output .csv just double quotes. How we prevent it?

    Hi all

    If we create any report Publisher and you try to view or download .csv format, fields that have data with more than one word just double quotes. If data have one word, she comes out with proposals and seems correct.

    If we look in excel or data XML seems good with on proposals and did not observe this behavior.

    Version: 11.1.1.5

    Steps to reproduce:


    1 create a model of simple data in select * from scott.dept

    2. create a blank layout and a report to display the data.

    Note: Varchar Fields so has more than one word, it is another to one word in quotes it look ok.

    Sample:

    DEPTNO, DNAME, LOC

    10, ACCOUNTING,"NEW YORK"

    20, RESEARCH, DALLAS

    30, SALES, CHICAGO

    40, OPERATIONS, BOSTON

    Let know if anything missed on my side. Pointers or suggestions would be appreciated.

    Hi all, just re-collected has nothing to do with OBIEE. By default, .csv apply quotes on all fields with special characters or spaces according to its characteristics. Since this is a valid scenario from the point of view OBIEE too, I have to use scripts to remove the quotation marks. Because my data do not have quotes, I remove all citations of my reports after being delivered. Using command on my unix below box and wrote a script based on my needs and expected. $sed-i of / ' / / g' Report1.csv thank you Kiss.

  • Help with SQL Loader when Clause

    I have 2 exact same structure Oracle tables.


    NUMBER OF ENO
    NUMBER OF PARENT
    NUMBER OF CHILDREN
    ENAME VARCHAR2 (50 bytes)
    ADDRESS VARCHAR2 (50 bytes)
    CITY VARCHAR2 (50 bytes)
    SRCFILENAME VARCHAR2 (50 bytes)
    SDATE VARCHAR2 (400 bytes)
    Current_Load VARCHAR2 (1 byte)




    Have a data file and a charger control file that loads data into these 2 tables.
    I need to make a conditional charge using a when clause.
    Condition: what MOTHER = CHILD, load table 2 other load in table 1

    My control file looks like this.
    LOAD DATA 
    INFILE 'TEST_20120815.txt' 
    APPEND INTO TABLE test1 
    fields terminated by "|" 
    trailing nullcols 
    ( 
    eno, 
    parent, 
    child, 
    ename, 
    address, 
    city , 
    sdate "to_date(:sdate,'DD/MM/YYYY')", 
    SrcFileName, 
    col7 filler, 
    "Current_Load" constant 'Y' 
    ) 
    INTO TABLE test2 when (parent=child) 
    fields terminated by "|" 
    trailing nullcols 
    ( 
    eno position(1), 
    parent, 
    child, 
    ename, 
    address, 
    city , 
    sdate "to_date(:sdate,'DD/MM/YYYY')", 
    SrcFileName, 
    col7 filler, 
    "Current_Load" constant 'Y' 
    ) 
    But it does not work. It works fine if I give a direct value like PARENT = 'P '.

    Any idea how compare the 2 fields while the conditional support?

    You can't compare 2 fields with the WHEN clause in SQL * file the charger control.
    only literal values as defined by the syntax:

    http://docs.Oracle.com/CD/B19306_01/server.102/b14215/ldr_control_file.htm#i1005657

    As already suggested, you'd be better to load data using an external table which allows to apply conditions you want in your SQL query, which is to get the data.

  • ORA-00907: lack the right parenthesis when using Group by clause with xmlagg

    I have the following query and I am getting ORA-00907 error when I use the clause with the xmlagg function group.
    select xmlelement("Mitigation",
                    xmlelement("m_szMethodName",tm.DisplayName),
                    xmlelement("SubstanceInterferenceProtocolList",
                                (select xmlagg(xmlelement("MitigationProtocol",
                                        xmlelement("m_szMethodName",tm.DisplayName),
                                        xmlelement("m_szInterferenceProtocolName",tmp.protocol_name),
                                        xmlelement("m_szInterferenceSubstance",tmp.intf_mtrl_prod_code),
                                        xmlelement("m_ProtocolParameters",
                                            xmlelement("m_szProtocolName",tmp.protocol_name),
                                                xmlelement("m_Consumables",
                                                    xmlelement("Consumable",
                                                        xmlelement("m_szConsumId", xrl.rgnt_pack_name),
                                                        xmlelement("m_szProductCode",xrl.pack_prod_code),
                                                        xmlelement("m_nVolume",tmp.fluid_vol),
                                                        xmlelement("m_szProtocolStep",xps.protocol_step_name))),
                                                    xmlelement("m_ProtParamList",
                                                        xmlagg(
                                                        xmlelement("ParameterValues",
                                                            xmlelement("m_szProtocolName",tmp.protocol_name),
                                                            xmlelement("m_Time",xpsd.parameter_ntime_value))
                                                        group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code)
                    )))
                    order by tmp.ccd_test_id, tmp.intf_mtrl_prod_code, xps.protocol_step_intprotocolstep )
                    from XPR_tdef_mitigation_protocol tmp, xp_reagentlist xrl,
                    xpr_protocol_settings xps, xpr_protocol_settings_default xpsd
                    where tmp.ccd_test_id = tm.ccd_test_id
                    and tmp.ccd_test_id = xrl.ccd_test_id
                    and tmp.pack_prod_code = xrl.pack_prod_code
                    and tmp.intf_type = 1
                    and xps.protocol_name = xpsd.protocol_name
                    and xps.protocol_step_name = xpsd.protocol_step_name
                    and xps.ps_action_parameterlist = xpsd.ps_action_parameterlist
                    and xps.protocol_name =  tmp.PROTOCOL_NAME
                    )))
    from XPtoXPRTdef_defn_mapping tm
    where tm.DisplayName = 'SYPH'
    If I remove the clause xmlagg and the group by clause, the query works well and not give me the result.
    But in this code XML, the output format is incorrect for my application.

    Could someone help out here?

    Now my problem is that this unique coating is more than 32767 characters and utl_file can write 32767 bytes per line.
    Someone deal with this?

    Serialize the output as CLOB and DBMS_XSLPROCESSOR.clob2file procedure used to write to a file:

    DECLARE
      xml_output CLOB;
    BEGIN
      SELECT XMLElement("Department",
               XMLAgg(
                 XMLElement("Employee",e.job_id||' '||e.last_name)
                 ORDER BY e.last_name
               )
             ).getClobVal() AS "Dept_list"
      INTO xml_output
      FROM hr.employees e
      WHERE e.department_id = 30 OR e.department_id = 40;
    
      DBMS_XSLPROCESSOR.clob2file(xml_output, 'XML_DIR', 'test.xml');
    END;
    /
    
  • Problem with the removal of the double quotes in my channel

    Hi all

    I am trying to replace two double quotes in my thong in double apostrophe.

    < v21:ID schemeAgencyID = "" NGCRM"" >


    I need to convert it to < v21:ID schemeAgencyID = "NGCRM" >


    For that, I use my code as below.

    Input=input.replace("\"\"","\" ");

    but there is no change in the output.

    Kindly tell me the error in the present.



    Thank you
    Sabarisri. N

    Published by: N Sabarisri August 1, 2011 12:20

    Sabarisri N wrote:
    Hi all

    I am trying to replace two double quotes in my thong in double apostrophe.

    I need to convert it to

    For that, I use my code as below.

    Input=input.replace("\"\"","\" ");

    but there is no change in the output.

    Kindly tell me the error in the present.

    Thank you
    Sabarisri. N

    Published by: N Sabarisri August 1, 2011 12:20

    It'll work. Here is the test program

    class StringReplaceTest
    {
         public static void main(String st[])
         {
              String st1 = "";
              System.out.println(" The st1 : "+st1);
              System.out.println(" The out put is : "+st1.replace("\"\"","\""));
    
         }
    }
    

    replace the text makes the sequence checking and replaceAll of character against the regex mill.

  • Regular expression, replace all commas between double quotes ONLY

    Hello

    I want to remove all commas between double quotes:

    I tried under model, but it does not replace all if we have more than one comma in double quotes.

    SELECT REGEXP_REPLACE (123, "45.6" Hello, "John, Mike, Marc", 456, "-Anne, Anna"', ' "([^"]*),([^"]*)" ', '"\1;\2" ', 1, 0) suite

    FROM DUAL;

    Result

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

    123, '45; 6"," Hello, "John, Mike;" "Marc", 456, "Anne-; Anna.

    the first comma between 'John, Mike; Marc"is not replaced...

    Recursion can do if you insist on the SQL solution

    with

    correct (INP, orig, CNT, res, Step) as

    (select str,

    substr(STR,2),

    -case when substr (str, 1, 1) = ""' then 1 else 0 end,

    substr (STR, 1, 1),

    1

    of (select 123, '45.6,' Hello, ' John, Mike, Marc ", 456, '-Anne, Anna', 'single_value' ' str of union double all the)

    Select "123456789" across double Union

    Select ' ""' of all the double union

    Select "" 123,456,789"" Union double all the

    Choose 123, '45.6,' Hello, ' John, Mike, Marc ", 456, 'Ann-Marie, Anna', 'unique value' ' double str

    )

    Union of all the

    Select the inp

    substr(orig,2),

    CNT + case when substr (orig, 1, 1) = ""' then 1 else 0 end,

    RES | cases where substr (orig, 1, 1) = ','

    so to case when mod(cnt,2) = 1

    then ' ~'

    else «»

    end

    of another substr (orig, 1, 1)

    end,

    Step + 1

    Rectifier

    where orig is not null

    )

    Select the inp, res

    Rectifier

    where the orig is null

    INP RES
    "" ""
    123456789 123456789
    "123456789". "123 ~ 456 ~ 789".
    123, '45.6' Hello, ' John, Mike, Marc ", 456, '-Anne, Anna', 'single_value '. "123," "45 ~ 6 ', Hello," John ~ Mike ~ Marc ", 456," Anne-~ Anna ',' single_value '.
    123, '45.6' Hello, ' John, Mike, Marc ", 456,"Ann-Marie, Anna","unique value ". "123," "45 ~ 6 ', Hello," John ~ Mike ~ ~ ~ Marc ', 456,' Anne-Marie ~ Anna "," unique value ".

    Concerning

    Etbin

  • REGEXP_REPLACE remove the comma in double quotes

    Hello

    I am trying to remove the comma of a string in double quotes, currently I can only remove a comma using under sql

    SELECT REGEXP_REPLACE (' "" A, B, C, def "', '(") ([^ "|,"] +) (,) ([^ ""] +) ("") ',' \1\2 \4\5' ') FROM DUAL;

    output: 'A B, C, def'

    But I need the form "A B C def".

    Hello

    Jarkko Turpeinen wrote:

    ... I think that I stop to answer here, because I don't understand of course questions

    Very understandable.  If my assumption is correct, the question would be much clearer if OP gave an example that included a few commas inside the quotation marks and some outside, as in the example below.

    Here's a way to implement what I have described in the answer #2 above:

    VARIABLE input_txt VARCHAR2 (100)

    EXEC: input_txt: = 1, '2', ' A, B, C, def ", 3" foo, bar '4 ';

    WITH got_parts AS

    (

    SELECT LEVEL AS part_num

    , REGEXP_SUBSTR (: input_txt)

    , '[^"]*("|$)'

    1

    LEVEL

    ) AS part_txt

    OF the double

    CONNECT BY LEVEL<= 1="" +="" regexp_count="" (="">

    , '"'

    )

    )

    SELECT LISTAGG (CASE

    WHEN MOD (part_num, 2) = 0

    THEN REPLACE (part_txt, ',')

    Of OTHER part_txt

    END

    ) Within AS output_txt GROUP (ORDER BY part_num)

    OF got_parts

    ;

  • Triggers the hide when clause

    I have a when clause contained in the header of an insert trigger that does not appear when you use SQL Developer to view the code.
    select
      text
    from
      user_source
    where
      name = 'FOO_INSERT_B_TRG'
    order by
      line;
    
    TEXT
    ----
    trigger bar.foo_insert_b_trg
      before insert
      on bar.foo
      for each row
      when (new.foo_id is null)
      declare
    begin
      :new.foo_id := key_pkg.create_key_f ('BAR', 'FOO');
    end foo_insert_b_trg;
    
    9 rows selected
    However, when I go back to the code by double-clicking the trigger I get this.
    create or replace 
    trigger bar.foo_insert_b_trg
      before insert
      on bar.foo
      for each row
      declare
    begin
      :new.foo_id := key_pkg.create_key_f ('BAR', 'FOO');
    end foo_insert_b_trg;
    Note that the 5 line, which has my when instruction, is missing. It is originally this line to actually be deleted when we open the object, modify it, and then save it.

    Published by: mimi on March 22, 2013 11:55

    Published by: mimi on March 22, 2013 12:01

    Published by: mimi on March 22, 2013 12:04

    Hi mimi,

    This problem has been reported before on this forum:
    Unable to see the WHEN clause for a trigger.

    The bug referenced in this thread is a regression in SQL Developer 3.1. and remains open. Any bug comments:

    With only minimal privileges, we query all_triggers to get only the package
    body (when-clause kept in a different column), whereas with
    SELECT_CATALOG_ROLE or DBA role we query dba_source that contains the full
    trigger source.
    

    Alternatives to work around this issue are:
    1. keep several versions of SQL Developer installed, using 3.1 when you need work with triggers.
    2. get additional privileges to avoid regression in 3.2

    Hope this helps,
    Gary
    SQL development team

Maybe you are looking for

  • Lightning don't talk to Google Calendar - problem with cookies?

    Execution of Thunderbird 31.1.0 with Lightning 1.0 and the module supplier of Google. I maintain four different calendars with google (work room, home, other, conf) account. When I woke up today all my calendars worked. They have been set up in light

  • How can I configure Thunderbird to several email addresses

    I'm on Eudora 7 to manage 6 on a Windows XP SP3 computer email accounts. I want to install Thunderbird on the same machine and import e-mail addresses. I have Setup Eudora to store the data files for each e-mail address in a different data directory.

  • Satellite A210 - increase memory x 1200

    Hello.I bought a RAM (2 GB) to my laptop (A210-15j). Will the graphics card to use more memory (x 1200)?Or it will use only 128 megabytes, regardless of the place?_______________________________________+ Sorry for my English. +

  • 11 s no sound

    Help one day I just opened my yoga 11 s and there suddenly without its good I play an mp3 file or play on a youtube video It has been over a month now

  • Computer does not detect CD players

    I am running Windows XP Professional SP3. While I was trying to solve another problem, I made the mistake to delete CDRALW2K. My computer SYS. Now my computer does not detect my CD players in the analysis of FDI, and that they are not listed anywhere