Parsing CSV to Oracle columns

Hi Gurus,
Need a help from you. I have a table(say, INSERT_CSV) in which a column(say, CSVFILE) with CLOB datatype is present. That column consists of a file in CSV format stored in as a CLOB.
Another table(Say, RGDEMO) has three columns (Employee_name, employee_id, employer). These data are present in the CSV format. Need to parse the csv from the first table and store the same in the second. There aremore than 20K records in there.
(DB is 9i)
Your help is much appreciated
Thanks!
Edited by: 796057 on Sep 20, 2010 2:14 PM

796057 wrote:
Actually I'm compelled to use CSV files stored in a db. We can not use SQL*Loader and/or External Tables also. And from the ASP UI, CSV file is getting stored in the Database.You have two basic choices.
Spool the CLOB to an external file (using the DBMS_LOB and UTL_FILE packages) and then load it as an external table.
The other choice is to use a custom token parser (changes a string into tokens) and then insert these tokens as column values into the destination table. I posted an example of such a token parser, written as a PL/SQL function, in {message:id=2416747}.
In pseudo code terms, you need to use the following approach to parse and insert the data:
  // get the glob
  select my_clob column into csvClob from my_table where col1 = primaryKeyValue;
  // read a line from the clob (each line will be terminated by a LF or CRLF set of characters)
  loop
     line := GetNextLineFromClob( csvClob ); // custom function that find the next line in a clob
     exit when line is null;  // no more lines to process
     tokens := Tokenise( line );  // convert the line into tokens (string array)
     insert into new_tab( col1, col2 ) values( tokens(1), tokens(2) ); // insert tokens into table
  end loop;
..The only real complexities here are the Tokenise and GetNextLineFromClob functions. You need to apply standard programming design and logic to deal with these - both does string processing. And this is one of the most common programming problems around. So it is not that difficult to design and code - and fairly easy to test too (do not need to create complex test data as input is string data).

Similar Messages

  • Parser - CSV files to Oracle database

    Hello all,
    I wrote a csv parser that parse csv files to micorsoft access database. Now I need to parse the dataset to oracle database. This is part of my exporter class
    class MdbExporter : IExporter
    /// <summary>
    /// Exportiert das DataSet in eine Mdb-Datei.
    /// </summary>
    /// <param name="ds">Zu exportierendes DataSet.</param>
    public void Write(DataSet ds, string[] names)
    string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
    "Data Source=" + names[0] + ";";
    Console.WriteLine("Exporting to database {0} ...", names[0]);
    Any ideas how can I do that?
    Thanks for any replay in advance.

    I wrote a parser that goes through several folders containing csv files, reads them and creates a dataset that contains 15 tables ( which I need for an intranet application after that). I succeed to write a MDB exporter that export this dataset to microsoft access database. Now I need an exporter that will export my dataset to ORACLE database. Below is the full code for my MDB exporter:
    public void Write(DataSet ds, string[] names)
    string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
    "Data Source=" + names[0] + ";";
    Console.WriteLine("Exporting to database {0} ...", names[0]);
    DbConnection connection = new OleDbConnection(conStr);
    try
    connection.Open();
    catch (DbException e)
    ConsoleEx.WriteException(true, e, "Unable to open database: {0}", names[0]);
    throw;
    DbCommand command = connection.CreateCommand();
    foreach (DataTable table in ds.Tables)
    Console.WriteLine("\tDeleting table: {0}", table.TableName);
    // delete old tables
    command.CommandText = string.Format("drop table {0}", table.TableName);
    TryExecute(command, false);
    // create new
    Console.WriteLine("\tCreating new table: {0}", table.TableName);
    string[] columnStrings = new string[table.Columns.Count];
    for (int i = 0; i < table.Columns.Count; i++)
    columnStrings[i] = "`" + table.Columns.ColumnName + "`" + " varchar";
    command.CommandText = string.Format("create table {0} ({1})",
    table.TableName, string.Join(", \n", columnStrings));
    TryExecute(command, true);
    // add rows
    for (int row = 0; row < table.Rows.Count; row++)
    for (int col = 0; col < table.Columns.Count; col++)
    columnStrings[col] = "'" + Convert.ToString(table.Rows[row].ItemArray[col]) + "'";
    command.CommandText = string.Format("insert into {0} values ({1})",
    table.TableName, string.Join(", \n", columnStrings));
    TryExecute(command, true);
    connection.Close();
    I need similar exporter to Oracle database. Starting with SQL LOADER from the beginning its really not a good in my opinion since I am almost done with this approach.
    Any help would be appreciated.
    Regards,
    Sven

  • Please - immediate help needed parsing csv values into multiple rows

    Hello, we have a very immediate need to be able to parse out a field of comma separated values into individual rows. The following is an example written in SQL Server syntax which does not work in Oracle.
    The tricky part is that each ROUTES can be a different length, and each CSV can have a different number of routes in it.
    Here is an example of the table ("Quotes") of CSV values I want to normalize:
    TPNUMBER ROUTES
    1001 1, 56W, 18
    1002 2, 16, 186, 28
    Here is an example of what I need it to look like:
    TPNUMBER ROUTES
    1001 1
    1001 56W
    1001 18
    1002 2
    1002 16
    1002 186
    1002 28
    Here is the "Tally" table for the query below:
    ID
    1
    2
    3
    4
    5
    6
    7
    And finally, here is the query which parses CSV values into multiple rows but which does not work in Oralce:
    SELECT TPNUMBER,
    NullIf(SubString(',' + ROUTES + ',' , ID , CharIndex(',' , ',' + ROUTES + ',' , ID) - ID) , '') AS ONEROUTE
    FROM Tally, Quotes
    WHERE ID <= Len(',' + ROUTES + ',') AND SubString(',' + Phrase + ',' , ID - 1, 1) = ','
    AND CharIndex(',' , ',' + ROUTES + ',' , ID) - ID > 0
    It may be necessary to use a cursor to loop through the CSV table and process each row (a loop within another loop...) but this is beyond my comprehesion of PL/SQL.
    Many thanks in advance for your advice/help.
    apk

    Not sure what you are trying to do with the last step, but this should work for the first part. I assume you would use sqlldr but I just did inserts instead. You might need more than 5 "routes" in the csv. You could put some reasonable max on that number of columns:
    SQL>create table t_csv
    2 (TPNUMBER varchar2(20),
    3 ROUTE_1 VARCHAR2(5),
    4 ROUTE_2 VARCHAR2(5),
    5 ROUTE_3 VARCHAR2(5),
    6 ROUTE_4 VARCHAR2(5),
    7 ROUTE_5 VARCHAR2(5),
    8 ROUTE_6 VARCHAR2(5) );
    Table created.
    SQL>INSERT INTO t_csv (TPNUMBER,ROUTE_1,ROUTE_2) values( '1001 1', '56W', '18' );
    1 row created.
    SQL>INSERT INTO t_csv (TPNUMBER,ROUTE_1,ROUTE_2,ROUTE_3) values( '1002 2', '16', '186', '28');
    1 row created.
    SQL>create table t_quotes(
    2 tpnumber NUMBER,
    3 routes VARCHAR2(5));
    Table created.
    SQL>DECLARE
    2 L_tpnumber NUMBER;
    3 L_route VARCHAR2(5);
    4 begin
    5 for rec in (select * from t_csv) loop
    6 L_tpnumber := SUBSTR(rec.tpnumber,1,INSTR(rec.tpnumber,' ')-1);
    7 L_route := SUBSTR(rec.tpnumber,INSTR(rec.tpnumber,' ')+1);
    8 insert into t_quotes values( L_tpnumber, l_route );
    9 if rec.route_1 is not null then
    10 insert into t_quotes values( L_tpnumber, rec.route_1 );
    11 end if;
    12 if rec.route_2 is not null then
    13 insert into t_quotes values( L_tpnumber, rec.route_2 );
    14 end if;
    15 if rec.route_3 is not null then
    16 insert into t_quotes values( L_tpnumber, rec.route_3 );
    17 end if;
    18 if rec.route_4 is not null then
    19 insert into t_quotes values( L_tpnumber, rec.route_4 );
    20 end if;
    21 if rec.route_5 is not null then
    22 insert into t_quotes values( L_tpnumber, rec.route_5 );
    23 end if;
    24 end loop;
    25 end;
    26 /
    PL/SQL procedure successfully completed.
    SQL> select tpnumber, routes from t_quotes;
    TPNUMBER ROUTE
    1001 1
    1001 56W
    1001 18
    1002 2
    1002 16
    1002 186
    1002 28
    7 rows selected.

  • Can't convert oracle.xml.parser.DTD to oracle.xml.parser.v2.DTD.

    I am getting the following Error while trying
    to compile the SampleMain.java file(Generating an XML document from a given Employee.dtd).
    I have set my classpath to use xmlparser.jar.
    D:\XMls>javac SampleMain.java
    SampleMain.java:65: Can't convert oracle.xml.parser.DTD to oracle.xml.parser.v2.DTD.
    main(java.l
    ang.String[]).
    generator.generate(dtd, doctype_name);

    Would you check the java parser version you are using? If using java parser V2, the normal lib name is xmlparserv2.jar.
    null

  • Parse times in Oracle 11G

    Has anyone else experienced extremely long parse times for Oracle 11G versus 10G? We are experiencing at least a 10 times increase in the parsing of our SQL statements. This is causing our customers to complain when running reports which contain several SQL statements that aren't in the SGA due to the infrequent use. I have opened a Service Request and development stated that this is to be expected with Oracle 11G due to the new optimizer features. I have tried to disable the features by settting the optimizer version to anything but 11G and no setting has helped. To make thing even worse, this increased parse time is on a new server that should be 2.5 times faster than the server that is running the 10G database. I do get at least a 2.5 times increase, larger if I/O intensive, in almost every other aspect of the database except for the parse times.

    user5999814 wrote:
    I wondered what the resolution was to this issue. We currently experiencing this will our Oracle 11.1.0.7 database with a small but important set of queries and it seems to be getting worse. We first noticed it with a query that went from taking 3.5 seconds to 7 seconds. A SQLTrace / TKProf revealed that 99% of the time was being spent during the parsing. A second similar query that brings in more data is taking around 1.5 minutes to parse then only a few seconds to actually execute. These are queries that are part of on online web transaction so this is not acceptable. We are able to replicate the behavior in multiple database instances.As a starting point it would be interesting to see the tkprof output from :
    alter session set events '10046 trace name context forever, level 8';
    +your select statement+
    exitWhen posting the output, use the "code" tags (see below) to make the output readable.
    Regards
    Jonathan Lewis
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    There is a +"Preview"+ tab at the top of the text entry panel. Use this to check what your message will look like before you post the message. If it looks a complete mess you're unlikely to get a response. (Click on the +"Plain text"+ tab if you want to edit the text to tidy it up.)
    +"I believe in evidence. I believe in observation, measurement, and reasoning, confirmed by independent observers. I'll believe anything, no matter how wild and ridiculous, if there is evidence for it. The wilder and more ridiculous something is, however, the firmer and more solid the evidence will have to be."+
    Isaac Asimov                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SQL*Loader-930: Error parsing insert statement for column

    we upload data on daily basis in application throug apps user and these table are invloved
    1. DEV_RA_INTERFACE_LINES_ALL(owner is a apps)
    2.RA_INTERFACE_LINES_ALL(owner is a AR)
    we do steps
    1 delete record from DEV_RA_INTERFACE_LINES_ALL table
    2 delete record from      RA_INTERFACE_LINES_ALL table
    3 load data using sql loader with apps user
    4 insert in RA_INTERFACE_LINES_ALL table
    we want to change user i mean these step do dataupload user not apps
    we give the proper rights to dataupload like select,delete and insert rights on these table to dataupload user but when i going to load data throug sql loader we receive error
    SQL*Loader-930: Error parsing insert statement for column APPS.DEV_RA_INTERFACE_
    LINES_ALL.ORIG_SYSTEM_BILL_ADDRESS_ID.
    ORA-00904: "F_ORIG_SYSTEM_BILL_ADDR_REF": invalid identifier
    and if i insert data through apps then done.

    make sure that u have no speces left
    between lines.
    give the path of control file path correctly.

  • Save HTML data in a Oracle Column

    what would be the best way to Save HTML data in a Oracle Column?
    while varchar2 can be used for upto 4000 bytes. it would still mean escaping a lot of special character. Is there a better way to do this? any help would be greatly appreciated.

    Besides the XML types available to you and the associated Oracle provided packages to input and extract XML I have heard arguments that both should be stored in the database. That is you should store the extracted data in normal Oracle columns so it can be used like any other attribute and that you should store the XML as XML which can then be used as XML.
    For data that is only inserted and deleted I can see this method but if updates to information within the XML is required then you just added another set of work requirements and complexity.
    Who is going to access the data? What tools are the users going to use? Where else does the data need to be provied to and in what format? The answers to who and how the data will be used should provide you with the answer of what form the data should be stored in.
    My personal view is that a relational database should be used for what it was designed for, storing relational data.
    HTH -- Mark D Powell --

  • " (quotes) is column values when loading data from csv to oracle table

    I am loading a data from csv file to an oracle table.
    After the data is loaded , lets suppose the value in one column is X.
    when i write a query to fetch data like
    select * from table where col='X' then it gives no output.
    On investigating it was found that the value is stored in col as "X".
    This also happens when i copy paste the value from column to some text editor ....
    i want to remove these double quotes , and also want to know why these are coming...
    Any suggestions guys ?
    Thanks
    Using Oracle 10g

    These quotes are part of your data file. Most CSV-parsers remove those quotes.
    If you are using an external table you can remove them by something like this for your access parameters
    ORGANIZATION EXTERNAL
      TYPE ORACLE_LOADER
      ACCESS PARAMETERS
        RECORDS DELIMITED BY NEWLINE
        FIELDS TERMINATED BY ','
        OPTIONALLY ENCLOSED BY '"'
    But if you want to remove them from your existing data use this
    update your_table
      set col1 = trim( '"' from col1 )
    Note that in some CSV-files wich use an enclosing character the enclosing character is itself is used as an escape character to use the enclosing character inside a field.
    For example a field might be "Some text with ""this"" enclosed"
    To correct these fields you might use another update
    update your_table
      set col1 = replace( col1, '""', '"' )

  • Parse CSV file with some dynamic columns

    I have a CSV file that I receive once a week that is in the following format:
    "Item","Supplier Item","Description","1","2","3","4","5","6","7","8" ...Linefeed
    "","","","Past Due","Day 13-OCT-2014","Buffer 14-OCT-2014","Week 20-OCT-2014","Week 27-OCT-2014", ...LineFeed
    "Part1","P1","Big Part","0","0","0","100","50", ...LineFeed
    "Part4","P4","Red Part","0","0","0","35","40", ...LineFeed
    "Part92","P92","White Part","0","0","0","10","20", ...LineFeed
    An explanation of the data - Row 2 is dynamic data signifying the date parts are due. Row 3 begins the part numbers with description and number of parts due on a particular date. So looking at the above data: row 3 column7 shows that PartNo1 has 100 parts
    due on the Week of OCT 20 2014 and 50 due on the Week of OCT 27, 2014.
    How can I parse this csv to show the data like this:
    Item, Supplier Item, Description, Past Due, Due Date Amount Due
    Part1 P1 Big Part 0 20 OCT 2014 100
    Part1 P1 Big Part 0 27 OCT 2014 50
    Part4 P4 Red Part 0 20 OCT 2014 35
    Part4 P4 Red Part 0 27 OCT 2014 40
    Is there a way to manipulate the format to rearrange the data like I need or what is the best method to resolve this? Moreover how do I go about doing this? 

    Hello,
    If the files have the same structure you can create an Integration Service Package.
    see this article
    http://www.mssqltips.com/sqlservertip/2923/configure-the-flat-file-source-in-sql-server-integration-services-2012-to-read-csv-files/
    Javier Villegas |
    @javier_vill | http://sql-javier-villegas.blogspot.com/
    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you

  • CSV to Oracle - (Integration) fails on the target ORACLE connection

    Hi,
    I am trying to load data from a csv file into Oracle db via ODI.
    Here are the steps i followed:
    1- Created the FILE physical schema
    1- Created the Oracle data server and physical schema in Physical Architecture
    2- Created and linked to logical schemas
    3- Created the correspondent data models and stores and a
    ble to view the data contents of the CSV and of the target table in ODI.
    4- Created interface, added csv as source and oracle table as target
    5- Used "LKM File to SQL" and "IKM SQL Control Append" (FLOW_CONTROL is false)
    When i execute the interface, the session starts then i receive the following wrror in Operator:
    ODI-1228: Task ARIBA_G1 (Integration) fails on the target ORACLE connection DEV_DW.
    Caused By: java.sql.SQLException: Non supported SQL92 token at position: 116
    at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:1319)
    at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:1190)
    at oracle.jdbc.driver.OracleSql.getSql(OracleSql.java:341)
    at oracle.jdbc.driver.OracleSql.getSqlBytes(OracleSql.java:649)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1079)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3752)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3937)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1535)
    at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:163)
    at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
    at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
    at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:537)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
    at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
    at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
    at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
    at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
    at java.lang.Thread.run(Thread.java:662)
    This is the Code section:
    BeanShell script error: Sourced file: inline evaluation of: ``if ( odiRef.getUserExit("FLOW_CONTROL").equals("1") ) { out.print(" \ninsert int . . . '' : Typed variable declaration : Error in method invocation: Method getDataSetMin() not found in class'com.sunopsis.dwg.snpreference.SnpReferenceInterne' : at Line: 25 : in file: inline evaluation of: ``if ( odiRef.getUserExit("FLOW_CONTROL").equals("1") ) { out.print(" \ninsert int . . . '' : odiRef .getDataSetMin ( )
    BSF info: Insert new rows at line: 0 column: columnNo
    if ( odiRef.getUserExit("FLOW_CONTROL").equals("1") ) { out.print(" \ninsert into\t") ;
    out.print(odiRef.getTable("L","TARG_NAME","A")) ;
    out.print(" \n( \n\t") ;
    out.print(odiRef.getColList("", "[COL_NAME]", ",\\n\\t", "", "((INS and !TRG) and REW)")) ;
    out.print(" \n\t") ;
    out.print(odiRef.getColList(",", "[COL_NAME]", ",\\n\\t", "", "((INS and TRG) and REW)")) ;
    out.print(" \n) \nselect\t") ;
    out.print(odiRef.getColList("", "[COL_NAME]", ",\\n\\t", "", "((INS and !TRG) and REW)")) ;
    out.print(" \n\t") ;
    out.print(odiRef.getColList(",", "[EXPRESSION]", ",\\n\\t", "", "((INS and TRG) and REW)")) ;
    out.print(" \nfrom\t") ;
    out.print(odiRef.getTable("L","INT_NAME","A")) ;
    out.print(" \n") ;
    } else { out.print(" \ninsert into\t") ;
    out.print(odiRef.getTable("L","TARG_NAME","A")) ;
    out.print(" \n( \n\t") ;
    out.print(odiRef.getColList("", "[COL_NAME]", ",\\n\\t", "", "((INS and !TRG) and REW)")) ;
    out.print(" \n\t") ;
    out.print(odiRef.getColList(",", "[COL_NAME]", ",\\n\\t", "", "((INS and TRG) and REW)")) ;
    out.print(" \n) \n\nselect\n    ") ;
    out.print(odiRef.getColList("", "[COL_NAME]", ",\\n\\t", "", "((INS and !TRG) and REW)")) ;
    out.print("   \n  ") ;
    out.print(odiRef.getColList(",", "[EXPRESSION]", ",\\n\\t", "", "((INS and TRG) and REW)")) ;
    out.print(" \nFROM (\t\n") ;
    for (int i=odiRef.getDataSetMin(); i <= odiRef.getDataSetMax(); i++){out.print("\n") ;
    out.print(odiRef.getDataSet(i, "Operator")) ;
    out.print("\nselect \t") ;
    out.print(odiRef.getPop("DISTINCT_ROWS")) ;
    out.print("\n\t") ;
    out.print(odiRef.getColList(i,"", "[EXPRESSION] [COL_NAME]", ",\\n\\t", "", "((INS and !TRG) and REW)")) ;
    out.print(" \nfrom\t") ;
    out.print(odiRef.getFrom(i)) ;
    out.print("\nwhere\t") ;
    if (odiRef.getDataSet(i, "HAS_JRN").equals("1")) { out.print("\n\tJRN_FLAG <> 'D'\t") ;
    } else {out.print("\t(1=1)\t") ;
    } out.print("\n") ;
    out.print(odiRef.getJoin(i)) ;
    out.print("\n") ;
    out.print(odiRef.getFilter(i)) ;
    out.print("\n") ;
    out.print(odiRef.getJrnFilter(i)) ;
    out.print("\n") ;
    out.print(odiRef.getGrpBy(i)) ;
    out.print("\n") ;
    out.print(odiRef.getHaving(i)) ;
    out.print("\n") ;
    }out.print("\n) ") ;
    out.print(odiRef.getInfo("DEST_TAB_ALIAS_WORD")) ;
    out.print(" ODI_GET_FROM\n\n") ;
    } out.print("\n") ;
    ****** ORIGINAL TEXT ******
    <%if ( odiRef.getUserExit("FLOW_CONTROL").equals("1") ) { %>
    insert into <%=odiRef.getTable("L","TARG_NAME","A")%>
    <%=odiRef.getColList("", "[COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%>
    <%=odiRef.getColList(",", "[COL_NAME]", ",\n\t", "", "((INS and TRG) and REW)")%>
    select <%=odiRef.getColList("", "[COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%>
    <%=odiRef.getColList(",", "[EXPRESSION]", ",\n\t", "", "((INS and TRG) and REW)")%>
    from <%=odiRef.getTable("L","INT_NAME","A")%>
    <% } else { %>
    insert into <%=odiRef.getTable("L","TARG_NAME","A")%>
    <%=odiRef.getColList("", "[COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%>
    <%=odiRef.getColList(",", "[COL_NAME]", ",\n\t", "", "((INS and TRG) and REW)")%>
    select
        <%=odiRef.getColList("", "[COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%>  
      <%=odiRef.getColList(",", "[EXPRESSION]", ",\n\t", "", "((INS and TRG) and REW)")%>
    FROM (
    <%for (int i=odiRef.getDataSetMin(); i <= odiRef.getDataSetMax(); i++){%>
    <%=odiRef.getDataSet(i, "Operator")%>
    select  <%=odiRef.getPop("DISTINCT_ROWS")%>
    <%=odiRef.getColList(i,"", "[EXPRESSION] [COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%>
    from <%=odiRef.getFrom(i)%>
    where <% if (odiRef.getDataSet(i, "HAS_JRN").equals("1")) { %>
    JRN_FLAG <> 'D' <%} else {%> (1=1) <% } %>
    <%=odiRef.getJoin(i)%>
    <%=odiRef.getFilter(i)%>
    <%=odiRef.getJrnFilter(i)%>
    <%=odiRef.getGrpBy(i)%>
    <%=odiRef.getHaving(i)%>
    <%}%>
    ) <%=odiRef.getInfo("DEST_TAB_ALIAS_WORD")%> ODI_GET_FROM
    <% } %>
    Any suggestions are highly appreciated.
    Mike

    Hi Santy,
    No, no error or bad files.
    Actually the data are moved correctly into the temp table created by ODI, but not from there to the final target table.
    I found out the reason though, the knowledge modules imported were from another ODI installation!
    I made sure to import the proper KM and it worked.
    Thanks!

  • How to import data from CSV file with columns separated by semicolon?

    I migrate database from MS SQL 2008 to ORACLE 11g
    I export data to CSV file from MS SQL
    then I try to import it to Oracle
    several tables goes fine using Import data option in the SQL Developer
    Standard CSV files with data separated by comma were imported.
    chars, date (with format string), and integer data are imported via import wizard without problems
    the problems were when I try to import table with noninteger numbers with modal part separated by comma not by dot
    comma is the standard separator for columns in CSV file
    so I must change the standard separator to semicolon
    then the import wizard have problem to correct recognize the columns data because it use only standard CSV comma separator :-/
    In SQL Developer 1.5.3 Tools -> Preferences -> Migration -> Data Move Options
    I change "End of Column Delimiter" to ; but it doens't work
    Is this possible to change the standard column separator for import data wizzard in SQL Developer 1.5.3?
    Or maybe someone know how to import data in SQL Developer 1.5.3 from CSV when CSV colunn separator is set to semicolon?

    A new preference has been added to customize the import delimiter in main code line. This should be available as part of future release.

  • Fastest way to load csv into oracle BE table

    I have csv file which is having 10 million records in it . what is the fastest approach to load this data to oracle BE table .
    I am using Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production With the Partitioning, OLAP and Oracle Data Mining options .
    csv format
    first_name,last_name,occupation,address
    above all the fields are of varchar data type.
    I have tried to use external table while inserting its taking too much time .
    Thanks

    hi,
    You can use sql loader.
    options (skip=1)
    LOAD DATA
    INFILE 'csv file path'
    truncate /append
    INTO table table_name
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    trailing nullcols
    column name ,
    column name,
    column name
    {code}
    Create this file as ctl(control file.) on the lcoation where your csv file is.
    Execute it by goint to the path where your csv file resides.
    {code}
    cmd
    cd path where your csv file resides
    sqllder userid=username/password@database name control=your_control_file_name
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • CSV export of [column link]

    Hi,
    I've got a report which can be exported to CSV. One of the columns has been changed to become a value with a column link (the link refers to another page in the application).
    Now the value of the column link isen't shown anymore in the export. According to the export, all values of this column are null...
    Why isen't it shown anymore and how can I make sure the original value will exported to?
    Thx.
    Frank

    Frank,
    Maybe this example will give you an idea:
    http://htmldb.oracle.com/pls/otn/f?p=31517:22
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • XML parser used in Oracle...DOM or SAX?

    Hi,
    My db version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0    Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    Question:
    I get an XML feed and load it into a temporary table T1.
    My requirement is to load it in the exact sequence as I get the rows in xml and also populate a column in the temporary table as a sequence like 1 2 3 corresponding to the rows in the xml
    When I do load the xml, it gets loaded in same order the xml feed is sent. So no worries.
    But while I was researching I came to know that Oracle could use either DOM or SAX parser. If it uses SAX, then the order is maintained as in XML. But if DOM is used, the order wont be maintained.
    Please let me know, how I can ensure that the xml order is maintained as it is while loading into temp table.

    I apologize, here is more details
    {code}
    CREATE TABLE XMLTEMPTBL
      PARAM      NVARCHAR2(30 BYTE),
      PARAMORDERSEQ NUMBER(3)
    XML format:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
    <PARAM1>abc</PARAM1>
    </ROW>
    <ROW>
    <PARAM2>def</PARAM2>
    </ROW> 
    <ROW>
    <PARAM3>ghi</PARAM3>
    </ROW> 
    <ROW>
    <PARAM4>jkl</PARAM4>
    </ROW>
    </ROWSET>
    PROCEDURE insertparams (p_xmldoc IN CLOB)
    IS    
      insctx   DBMS_XMLSTORE.ctxtype;
      ROWS     NUMBER;     
    BEGIN     
      /*inserting insdoc into a temp table*/
      insctx := DBMS_XMLSTORE.newcontext ('xmlTempTbl');
      ROWS := DBMS_XMLSTORE.insertxml (insctx, p_xmldoc);
      DBMS_XMLSTORE.closecontext (insctx);
    END;
    I want to insert into table this way:
    select * from xmltemptb;
    PARAM PARAMORDERSEQ
    abc 1
    def 2
    ghi 3
    jkl 4
    {code}
    My procedure is not 100% correct (but it gives an idea what code I am using to load into table), but I want to ensure the xml rows are loaded into the table in the same sequence.

  • CSV in a Column, Want to select one value at a time.

    Hello ,
    Oracle Database 11g.
    I have a procedure in which i have to compare some value from a table. The problem is that the value in the table is in CSV ( Coma Separated Value).... see below
    select parameter_name,description from t_mes_configurable_parameter
    where parameter_name='DC_LOG_LEVEL'
            Parameter_Name                          Description
         DC_LOG_LEVEL                               DC log level ,ERROR=0,SYSTEM=1,INFO=2,DEBUG=3
    Now as you can see the description column has a CSV's. Now i want to get the values individually.
    In some different procedure i have to compare this value one - by - one.
    If DESCRIPTION = 'DC log level' or 'ERROR=0' ...... then
    -- some query --
    end if;
    Can i right any select query in which it will return me this column value as single value separating  from ' , ' (coma). ???
    Thanks in advance .

    Something like this ?
    SQL> set line 1500
    SQL> WITH test as 
      2     (SELECT 'DC_LOG_LEVEL' col1,'DC log level ,ERROR=0,SYSTEM=1,INFO=2,DEBUG=3' col2 FROM dual UNION ALL
      3      SELECT 'EF_LOG_LEVEL' col1,'EF log level ,ERROR=0,SYSTEM=1,INFO=2,DEBUG=3' col2 FROM dual UNION ALL
      4      SELECT 'GH_LOG_LEVEL' col1,'GH log level ,ERROR=0,SYSTEM=1,INFO=2,DEBUG=3' col2 FROM dual
      5     ) 
      6  ----End of Test data Creation -----
      7  ---- Actual Query -----------------  
      8     SELECT DISTINCT col1,regexp_substr (col2, '[^,]+', 1, level) col2 
      9     FROM test 
    10     CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (col2, '[^,]+'))  + 1
    11     ORDER BY 1;
    COL1         COL2
    DC_LOG_LEVEL DC log level
    DC_LOG_LEVEL DEBUG=3
    DC_LOG_LEVEL ERROR=0
    DC_LOG_LEVEL INFO=2
    DC_LOG_LEVEL SYSTEM=1
    EF_LOG_LEVEL DEBUG=3
    EF_LOG_LEVEL EF log level
    EF_LOG_LEVEL ERROR=0
    EF_LOG_LEVEL INFO=2
    EF_LOG_LEVEL SYSTEM=1
    GH_LOG_LEVEL DEBUG=3
    COL1         COL2
    GH_LOG_LEVEL ERROR=0
    GH_LOG_LEVEL GH log level
    GH_LOG_LEVEL INFO=2
    GH_LOG_LEVEL SYSTEM=1
    15 rows selected.
    SQL> OR
    SQL> WITH test as 
      2     (SELECT 'DC_LOG_LEVEL' col1,'DC log level ,ERROR=0,SYSTEM=1,INFO=2,DEBUG=3' col2 FROM dual UNION ALL
      3      SELECT 'EF_LOG_LEVEL' col1,'EF log level ,ERROR=4,SYSTEM=5,INFO=6,DEBUG=7' col2 FROM dual UNION ALL
      4      SELECT 'GH_LOG_LEVEL' col1,'GH log level ,ERROR=0,SYSTEM=1,INFO=2,DEBUG=3' col2 FROM dual
      5     ) 
      6  ----End of Test data Creation -----
      7  ---- Actual Query -----------------  
      8  SELECT col1,REGEXP_SUBSTR(col2,'[^=]+',1,1)col2,REGEXP_SUBSTR(col2,'[^=]$+',1,1) col3
      9    FROM (
    10           SELECT DISTINCT col1,regexp_substr (col2, '[^,]+', 1, level) col2 
    11           FROM test 
    12           CONNECT BY LEVEL <= LENGTH (REGEXP_REPLACE (col2, '[^,]+'))  + 1
    13         )
    14     ORDER BY 1,3;
    COL1         COL2
    COL3
    DC_LOG_LEVEL DC log level
    DC_LOG_LEVEL ERROR
    0
    DC_LOG_LEVEL SYSTEM
    1
    COL1         COL2
    COL3
    DC_LOG_LEVEL INFO
    2
    DC_LOG_LEVEL DEBUG
    3
    EF_LOG_LEVEL EF log level
    COL1         COL2
    COL3
    EF_LOG_LEVEL ERROR
    4
    EF_LOG_LEVEL SYSTEM
    5
    EF_LOG_LEVEL INFO
    6
    COL1         COL2
    COL3
    EF_LOG_LEVEL DEBUG
    7
    GH_LOG_LEVEL GH log level
    GH_LOG_LEVEL ERROR
    0
    COL1         COL2
    COL3
    GH_LOG_LEVEL SYSTEM
    1
    GH_LOG_LEVEL INFO
    2
    GH_LOG_LEVEL DEBUG
    3
    15 rows selected.
    SQL> Edited by: Saubhik on Dec 20, 2010 6:17 PM

Maybe you are looking for

  • Am I experiencing hard drive failure or is it something else?

    Hi everyone! I have a late 2011, 13 inch, 2.4 Ghz macbook pro bought new in 2012 with a 7200RPM HDD option. Ever since I got my computer it seemed slow and sluggish, even with its fresh install. I even re-installed completely after 10.8 came out just

  • Can I use my iPhone in europe?

    Can I use my iPhone in Europe?

  • In which table chenges in sales orders are getting saved

    Hi Experts, I have a query <b>in which table chenges in sales orders are getting saved</b> Thanks & Regards Prashant Gupta

  • AJAX ScriptManager problems on iPhone

    Hi, i'm developing an asp.net web application for iphone and i'm using ajax. I have no problems with the ajax behaviours (all the ajax controls like update panels are running correctly...). But I have a problem with the ScriptManager itself: adding a

  • T400 AT&T WWAN question

    I know this has been discussed already, but my searches couldn't find the info I needed. I have a T400 6475-B14 and I would like to be able to use it with an AT&T SIM. However I'm not sure if I need to install new hardware, or if my machine already h