Apostrophe in a String bombs a SQL insert

I am having an issue with a Customer String parameter that is being used in a SQL INSERT. The customer name may from time to time have an apostrophe in it that causes our SQL INSERT to bomb on a missing comma error. I have tried to do this two separate ways:
1)
String query = "INSERT into CUSTOMER VALUES(" + account[0].custAcctNbr + ",'" + account[0].companyNm + "'," +
               "'IN',null," + salesPerson[0].salespersonID + "," + "null,null,null,null,null," +
               "null,null,null,null,null,null,null,null,null)";
This works until an apostrophe is in the companyNm varaiable.
2)
     PreparedStatement insertCustomer = bcc_conn_cust.prepareStatement(
     "INSERT into CUSTOMER VALUES(?,?,?,null,?,null,null,null,null,null,null,null,null,null,null,null,null,null,null");
     insertCustomer.setInt(1,Integer.parseInt(account[0].custAcctNbr));
     insertCustomer.setString(2,account[0].companyNm);
     insertCustomer.setString(3,"IN");
     insertCustomer.setInt(4,salesPerson[0].salespersonID);
     insertCustomer.executeUpdate();
This also works when there is no apostrophe. However both bomb when it is present. Is there anyway to get around this, short of parsing a company name every single time we insert a new customer?

Do you have any idea why this is not working? yes, whatever driver you are using isn't implementing this properly.
variable I am using is a String variable, that has a
value of Bates' Brownies. According to all I read, it
seems I have used the Prepared Statement correctly but
it is giving me that missing comma error. I would
really rather not have to search every single company
name as it is entered.well unless you can either find another driver or fix the one you've
got i can't see what else you can do...
here is some code to help you along with that.
private String replaceQuotes(String toReplace){
  StringBuffer buff = new StringBuffer(toReplace);
  for(int i=0;i<buff.length();i++){
    if(buff.charAt(i)=='\''){
      buff.insert(i,'\'');
      i++;
  return buff.toString();

Similar Messages

  • SQL insert statement in java with Excel file

    Dear all,
    I wrote a program is as the follow:
    import java.io.*;
    import java.sql.*;
    public class handleExcel
         Connection con = null;
         Statement stmnt = null;
         public handleExcel()
              String excel = "C:\\EGS\\app_files\\info_update_form_exported_data.xls";
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   String str="jdbc:odbc:DRIVER=Microsoft Excel Driver (*.xls);DBQ=" + excel + ";";
         String sql = "insert into [Sheet1$] (Name, Age, Test1, Test2, Test3) values ('mary','16','aa','bb','vv')";
                   con = DriverManager.getConnection(str, "", "");
                   stmnt = con.createStatement();
                   stmnt.executeUpdate(sql);
              catch(Exception e)
                   System.out.println("con is error!!");
                   e.printStackTrace();
         public static void main(String[] args)
              handleExcel TestHpc = new handleExcel();
    But when I run it, the error is as the follow:
    java.sql.SQLException: [Microsoft][ODBC Excel Driver]
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
         at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
         at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
         at hk.gov.edb.util.handleExcel.<init>(handleExcel.java:31)
         at hk.gov.edb.util.handleExcel.main(handleExcel.java:97)
    Please help me to solve this problem. Thank you so much for your help!
    Regards,
    kzyo

    Hi
    You can use the[b] jakarta POI api in order to read/write Excel file from java. Pure Java, no drivers nedeed.
    I tested and ok.
    Hope this helps

  • ABAP connect SQL run SQL insert into Error

    Dear All
             I have a problem in ABAP connect SQL,Below is my code snippet sentence.
    CONCATENATE 'Insert Into [timportcortrol]'
                    '(zucode,zstate,zdate,zkind) Values('''
                      VG_PCID ''','''
                      '1'','''
                      SY-DATUM ''','''
                      '1' ''')'
                     INTO SQL.
        CALL METHOD OF REC 'Execute'
         EXPORTING #1 = SQL
         #2 = CON
         #3 = '1'.
    IF NOT SY-SUBRC = 0.
        MESSAGE I000 WITH 'Download  to [timportcortrol] failure,Please Check the SQL Connect!!! '.
        EXIT.
      ENDIF.
    "Con:is the connect SQL String ,the connect SQL is Okay.
    I debug this code,when I used u2018Select u2026sentenceu2019,the program can work.if I  use u2018insert intou2019 then canu2019t work,but I copied the SQL of the u2018inset Into sentenceu2026u2019run it into SQL server then it can work also.
    And I found the SY-SUBRC eq u20182u2019.whatu2019s mean about of the sy-subrc eq u20182u2019.
    I think the insert into sentence in abap I have write the wrong ,but I canu2019t assurance.
    The Insert Into Sentence is:u2019 Insert Into [timportcortrol](zucode,zstate,zdate,zkind) Values('20080807094713','1','20080807','1')u2019
    Could you give me some advice for this issue?
    Thanks of all
    Sun.

    Hi
    I think the problem is with the date format "20080807094713". You should know first how the date is stored in the underlying database. In that format we have to pass the date in the SQL DML statements.
    Try "07-Aug-2008' for example and check.
    Hope it helps.
    Murthy

  • Use APEX API to export images as sql inserts

    I was wondering if it is possible to export a custom table with images as sql insert statements, using the APEX API.

    I've uploaded an image as a workspace image. When I click "display install file script" I get the following code:
    begin
    wwv_flow_api.g_varchar2_table := wwv_flow_api.empty_varchar2_table;
    wwv_flow_api.g_varchar2_table(1) := '424D92000000000000003...   etc ;
    wwv_flow_api.g_varchar2_table(2) := 'A800E9FE9800EAFE9800E...   etc ';
    end;
    declare
        l_name   varchar2(255);
    begin
        l_name := 'B73.bmp';
      wwv_flow_api.create_or_remove_file(
         p_name=> l_name,
         p_varchar2_table=> wwv_flow_api.g_varchar2_table,
         p_mimetype=> 'image/bmp',
         p_location=> 'WORKSPACE',
         p_nlang=> '0',
         p_mode=> 'CREATE_OR_REPLACE',
         p_type=> 'IMAGE');
    end;
    /How do I generate these strings to export my images.

  • Help with sql insert single quotes

    String insert = "INSERT INTO users(firstName, lastName, emailAdd, password) VALUES("+ firstNameForm + "," + lastNameForm + "," + emailForm + "," + passwordForm + ")";
    Statement stmt = conn.createStatement();
         int ResultSet = stmt.executeUpdate(insert);
    I have that sql insert statment in my servlet the servlet compiles fine but does not insert into the users table, i have been told that it is something to do with single quotes in sql statement, can anybody help me out?

    Or can i change my sql table is there a autonumber which would increase everytime this servlet runs?make your field autoincrement :-)
    example
    ALTER TABLE `users` CHANGE `user_id` `user_id` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT To insert record in the table.
    example:
    you have a table test and got two fields,
    id = (INT) autoincrement
    name = VARCHAR / TEXT etc.
    to insert data to the table test try something like this:
    String SQLStatement = "INSERT INTO test";
    SQLStatement += "(name)";
    SQLStatement += " VALUES (?)";
    statement = Conn.prepareStatement(SQLStatement);
    statement.setString(1, "Duke");
    statement.executeUpdate();
    statement.close();
    Conn.close();Note we dont provide the field for id on our sql statement since it is set as auto-increment ;-)
    regards,
    Message was edited by:
    jie2ee

  • SQL INSERT problem - help please

    Hello,
    I'm having a problem with INSERT statement.
    There is a "ShowFinal.jsp" page, which is a list of candidates who selected from the second
    interview. The user picked some candidates from the list and conduct the 3rd interview. After
    he check suitable candidates(who are selected from the 3rd interview) from the list , enter
    basic salary for every selected candidate, enter date of interview and finally submit the form.
    These data should be save into these tables.
    FinalSelect(nicNo,date)
    EmpSalary(nicNo,basicSal)
    In this "ShowFinal.jsp" page, it validates the following conditions using JavaScript.
    1) If the user submit the form without checking at least one checkbox, then the system should be
    display an alert message ("Please select at least one candidate").
    2) If the user submit the form without entering the basic salary of that candidate which was
    checked, then the system should be display an alert message ("Please enter basic salary").
    These are working well. But my problem is how to wrote the "AddNewFinal.jsp" page to save these
    data into the db.
    Here is my code which I have wrote. But it points an error.
    "AddNewFinal.jsp"
    String interviewDate = request.getParameter("date");
    String[] value = request.getParameterValues("ChkNicno");
    String[] bs = request.getParameterValues("basicSal");
    String sql ="INSERT INTO finalselect (nicNo,date) VALUES(?,?)";
    String sql2 ="INSERT INTO EmpSalary (nicNo,basicSal) VALUES(?,?)";
    for(int i=0; i < value.length; i++){
         String temp = value;     
         for(int x=0; x < bs.length; x++){
              String basic = bs[x];
              pstmt2 = connection.prepareStatement(sql2);
              pstmt2.setString(1, temp);
              pstmt2.setString(2, basic);
              int RowCount1= pstmt2.executeUpdate();
         pstmt1 = connection.prepareStatement(sql);
         pstmt1.setString(1, temp);
         pstmt1.setString(2, interviewDate);
         int RowCount= pstmt1.executeUpdate();
    Here is the code for "ShowFinal.jsp".
    <form name="ShowFinal" method="POST" action="AddNewFinal.jsp" onsubmit="return checkEmpty() &&
    ValidateDate();">
    <%--  Loop through the list and print each item --%>
    <%
         int iCounter = 0; //counter for incremental value
         while (igroups.hasNext()) {
              Selection s = (Selection) igroups.next();
              iCounter+=1; //increment
    %>
    <tr>
         <td style="background-color:ivory" noWrap width="20">
         <input type="checkbox" name="<%= "ChkNicno" + iCounter %>"      
    value="<%=s.getNicno()%>"></td>
            <td style="background-color:ivory" noWrap width="39">
                 <%= s.getNicno() %>  </td>
         <td style="background-color:ivory" noWrap width="174">
              <input type="text" name="<%= "basicSal" + iCounter %>" size="10"> </td>
    </tr>
    <%
    %>
    Date of interview<input type="text" name="date" size="17"></td>
    <input type="submit" value="APPROVE CANDIDATE" name="B1" style="border: 1px solid #0000FF">
    </form>........................................................
    Here is the error generated by TOMCAT.
    root cause
    java.lang.NullPointerException
         at org.apache.jsp.AddNewFinal_jsp._jspService(AddNewFinal_jsp.java:70)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
    I have goto the file "AddNewFinal_jsp.java". The line 70 points to the following line.
    for(int i=0; i < value.length; i++){ [/b]
    Please can someone help me to solve this problem? Please help me to do this task.
    Thanks.

    Hi Casabianca ,
    It is clearly that your problem is not on the database end, more like a servlet/jsp issue.
    I will not comment on the javascript portion, but rather the 2 jsps.
    a simple way to trace what's go wrong is to check the final result (the html code) of the first jsp (showFinal.jsp), and compare against what is expected by the 2nd jsp (AddNewFinal.jsp). Most browser do provide "view source" on the page visited.
    the following code
    <input type="checkbox" name="<%= "ChkNicno" + iCounter %>" value="<%=s.getNicno() %>">
    <input type="text" name="<%= "basicSal" + iCounter %>"
    would likely to be "translated" to html code something as follow:
    <input type="checkbox" name=""ChkNicno0" value="nicNo>">
    <input type="text" name="basicSal0">
    the original code in "AddNewFinal.jsp" using
    request.getParameterValues("ChkNicno");
    which looking for a none exist http request parameter (sent as "ChkNicno0",etc but look for "ChkNicno"), which has explained before.
    the second attempt to use String[] value = request.getParameterValues("ChkNicno" + iCounter); give Cannot resolove symbol :iCounter. because iCounter never defined in the 2nd jsp!
    Most of the error message do give clue to cause of error... : )
    not too sure on your intension, assume you wish to update only those selected (checked) row to db.
    some suggestions:
    1) <input type="text" name="ChkNicno" size="10"> </td>...
    <input type="text" name="basicSal" size="10"> instead.
    then use javascript to based on checked element index (refer to javascript spec for more details), for those index not checked, clear off the correspond index "basicSal" field value.
    e.g. ChkNicno[1] is not checked, empty basicSal[1] value before submission.
    This will give us only selected rows values.
    2) retain the code
    String[] value = request.getParameterValues("ChkNicno");
    String[] bs = request.getParameterValues("basicSal");at 2nd jsp, as now the http request will pass parameters using "ChkNicno" and "basicSal".
    3) some change to the code for optimization
    for(int i=0; i < value.length; i++){
         String temp = value;     
         for(int x=0; x < bs.length; x++){
              String basic = bs[x];
              pstmt2 = connection.prepareStatement(sql2);
              pstmt2.setString(1, temp);
              pstmt2.setString(2, basic);
              int RowCount1= pstmt2.executeUpdate();
         pstmt1 = connection.prepareStatement(sql);
         pstmt1.setString(1, temp);
         pstmt1.setString(2, interviewDate);
         int RowCount= pstmt1.executeUpdate();
    to
    pstmt1 = connection.prepareStatement(sql);
    pstmt2 = connection.prepareStatement(sql2);
    for(int i=0; i < value.length; i++){
         String temp = value;     
         for(int x=0; x < bs.length; x++){
              String basic = bs[x];
              pstmt2.setString(1, temp);
              pstmt2.setString(2, basic);
              int RowCount1= pstmt2.executeUpdate();
         pstmt1.setString(1, temp);
         pstmt1.setString(2, interviewDate);
         int RowCount= pstmt1.executeUpdate();
    preparestatement created once should be sufficient as we do not change the sql statement throughout the loop.
    there are better solutions out there, this just some ideas and suggestions.Do try out if you wish.
    Hope it helps. : )

  • SQL Insert Error Error in allocating a connection. Cause: No PasswordCreden

    Friends,
    While testing my connection in the Sun java Application Server , I get the following error .
    "SQL Insert Error Error in allocating a connection. Cause: No PasswordCredential found "
    Can somebody please guide ?
    regards
    Dhiraj

    If you are using Netbeans, then this link might help:
    http://forum.java.sun.com/thread.jspa?forumID=136&threadID=598423
    Otherwise, have you try this ?
    Verify your sun-ejb-jar.xml does not use default-resource-princinpal element:
    <res-ref-name>jdbc/pdisasdb</res-ref-name>
    <jndi-name>jdbc/pdisasdb</jndi-name>
    <default-resource-principal>
    <name>myname</name>
    <password>geheim</password>
    </default-resource-principal>
    </resource-ref>

  • How to resolve ORA-00001 Error in SQL Insert?

    Hi all, I need your appreciated help.
    I make a plsql procedure that is inserting a row according cursor value, I'm having oracle error ORA-00001: unique constraint (constraint_name) violated.
    You may see this message if a duplicate entry exists at a different level: in RDBMS MySQL I have the syntax IGNORE to resolve this duplication error... and in Oracle ?
    Thanks for your time and hints.
    Miguelito

    user6317803 wrote:
    How to resolve ORA-00001 Error in SQL Insert?ORA-00001 means table has unique/primary key/index and you are trying to insert a row with key value that already exists in the table. I'll assume table COUNTRIES has primary key on COUNTRY_ID. Then change SQL to:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ')"There is a good chance table COUNTRIES also has unique key/index on COUNTRY_NAME. If so use:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ' OR COUNTRY_NAME = 'BLZ')"SY.

  • How I can make SQL Insert file on schedule

    Dear Community Members;
    Hope all you will be perfect. I required your urgent response on my query. I want to make an SQL Insert file, means I want to insert data from query in one table and after that, the data export in an SQL file as a SQL Insert file.
    All these things want to do on schedule not manually.
    Can anyone help and guide me how I can do it?

    Dear Members;
    Actually, we are working on two different applications, like sale and account. Now we want to post sale information in account system without any DBLink, for that I want to make a file where my data store in SQL Insert Statement format on scheduling, means I want to create a procedure which create this file on scheduling. After that same as I want to create a procedure in other system for read that file and execute. Now I have been found Oracle functionality but still I am facing a problem. The problem is that my procedure create a file with a single record not the all fetched record. My Procedure is as:
    DECLARE
      fileHandler UTL_FILE.FILE_TYPE;
      INSERT1 VARCHAR2(200);
      INSERT2 VARCHAR2(200);
      cursor c1 is
        select T.QTY, T.SLIP_NO, T.STORE_NO, T.Item_Code
        from test t
        where T.STORE_NO = 1;
    BEGIN
        for cur_rec in c1 loop
        INSERT1 := 'INSERT INTO TEST_2(Item_Code,STORE_NO,QTY,SLIP_NO) VALUES(';
        INSERT2 := INSERT1||CUR_REC.Item_Code||','||CUR_REC.STORE_NO||','||CUR_REC.QTY||','||CUR_REC.SLIP_NO||')' ;
      fileHandler := UTL_FILE.FOPEN('E:\Oracle\admin\udump', 'test_file2.SQL', 'W');
      --UTL_FILE.PUTF(fileHandler, 'Writing TO a file\n');
      UTL_FILE.PUTF(fileHandler, INSERT2);
      UTL_FILE.PUTF(fileHandler, '\n commit;');
      UTL_FILE.FCLOSE(fileHandler);
      END LOOP;
    EXCEPTION
      WHEN utl_file.invalid_path THEN
         raise_application_error(-20000, 'ERROR: Invalid PATH FOR file.');
    END;
    Please suggest/guide me where I am doing something wrong or missing. I'll thankful for your help.

  • Sql insert statement will fail if the data value has empty line

    Hi,
    I notice if the insert statement in my .sql file contains data that has new line (enter key), the insert will fail.
    For example:
    insert into mytable (message)
    values ('this is the first line
    this is the second line that will cause insert statement to fail
    so as this third line');
    commit;
    How to overcome this?
    Please advise.
    Thank you.
    Message was edited by:
    bchurn
    Message was edited by:
    bchurn

    It did not return me any error. What is the error you are receiving ??
    SQL> create table mytable (message varchar2(500));
    Table created.
    SQL> insert into mytable (message)
      2  values ('this is the first line
      3  this is the second line that will cause insert statement to fail
      4  so as this third line');
    1 row created.
    SQL> @c:\test.txt
    1 row created.contents of c:\test.txt
    <<
    insert into mytable (message)
    values ('this is the first line
    this is the second line that will cause insert statement to fail
    so as this third line');
    >>

  • Parsing a string in PL/SQL?

    I am parsing a string in PL/SQL and at a certain point(Length 45) of the string I would like to add a carriage return (Chr(10)), then continue with the string at that point and then again if the string is greater than Length 45 add a carriage return.
    I program in Powerbuilder and have figured it out, but I have a problem when trying to add a carriage return at a certain point in the string in PL/SQL. There is the REPLACE(), but that will replace everything, but I only want to add it at that certain point of the string. With the PB function I can add the carriage return at a certain point, see code:
    Li_pos = PosA( Ps_data, '*')
    DO WHILE Li_pos > 0
    ll_length = Li_pos - ll_old_pos
    IF ll_length > 45 THEN
    ll_old_pos = Li_pos
    Ps_data = ReplaceA( Ps_data, Li_Pos, 1, ls_carriage_rtn) **This function gives me the ability to add a carriage return at a certain point in the string. **
    Li_pos = PosA( Ps_data, '*', Li_pos + 1 + ls_carriage_rtn)
    ELSE
    Li_pos = PosA( Ps_data, '*', Li_pos + 1)
    END IF
    LOOP
    I have incorporated the same logic in PL/SQL but I am looking for something similar to the ReplaceA function in PB, that will replace at a certain point in a string. I use an '*' as a placeholder and measure the length. Below is the PL/SQL code:
    t_pos NUMBER;
    t_old_pos NUMBER;
    t_length NUMBER;
    BEGIN
    t_old_pos := 0;
    t_pos := INSTR(in_model_list, '*');
    WHILE t_pos > 0 LOOP
    t_length := t_pos - t_old_pos; -- This looks at current position minus the old position, measures the length
    IF t_length > 45 THEN
    t_old_pos := t_pos;
    *** add that carriage return
    t_pos := INSTR(in_model_list, '*', t_pos + 1 + Chr(10)); -- get the new position
    NULL;
    ELSE
    t_pos := INSTR(in_model_list, '*', t_pos + 1);
    END IF;
    NULL;
    END LOOP;
    Here is the data, what it looks like: William 112,* 500-A,* 500-U,* 520,* 560-A,* 560-E,* 680-E,* 680-F,* 680-V*
    Any help would be much appreciated.
    Thank you,
    William
    Edited by: William on Feb 28, 2012 6:56 AM

    Frank Kulash wrote:
    [example]I played with your example and came to this:SQL> WITH my_string AS
      2         (SELECT '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'
      3                   AS mt
      4            FROM DUAL)
      5     ,  line_length AS
      6         (SELECT 13 AS chars
      7            FROM DUAL)
      8      SELECT LISTAGG (REGEXP_SUBSTR (mt,'(.{'|| line_length.chars|| '})', 1, LEVEL),chr(10)) WITHIN GROUP (ORDER BY LEVEL)
      9             ||chr(10)
    10             ||substr(mt,-mod(LENGTH (mt),line_length.chars)) as wrapped_text
    11        FROM my_string
    12        CROSS JOIN line_length
    13  CONNECT BY LEVEL < 1+LENGTH (mt) ;
    WRAPPED_TEXT
    1234567890123
    4567890123456
    7890123456789
    0123456789012
    3456789012345
    6789012345678
    9012345678901
    2345678901234
    5678901234567
    8901234567890
    1234567890123
    WRAPPED_TEXT
    4567890123456
    7890
    SQL>*[Edit]* annotated that this is 11g only...
    Edited by: T.PD on 29.02.2012 21:17

  • Convert a String to java.sql.Date Format

    Hi,
    I am having a String of containing date in the format 'dd/mm/yyyy' OR 'dd-MMM-YYYY' OR 'mm-dd-yyyy' format. I need to convert the string to java.sql.Date object so that I can perform a query the database for the date field. Can any one suggest me with the code please.
    Regards,
    Smitha

    import java.text.SimpleDateFormat;
    import java.text.ParseException;
    import java.util.Date;
    public class TestDateFormat
         public static void main(String args[])
              SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
              System.out.println(sdf.isLenient());
              try
                   Date d1 = sdf.parse("07-11-2001");
                   System.out.println(d1);
                   Date d2 = sdf.parse("07:11:2001");
                   System.out.println(d2);
              catch(ParseException e)
                   System.out.println("Error format, " + e);
    See class DateFormat and SimpleDateFormat for detail.

  • SQL insert with select statement having strange results

    So I have the below sql (edited a bit). Now here's the problem.
    I can run the select statement just fine, i get 48 rows back. When I run with the insert statement, a total of 9062 rows are inserted. What gives?
    <SQL>
    INSERT INTO mars_aes_data
    (rpt_id, shpdt, blno, stt, shpr_nad, branch_tableS, csgn_nad,
    csgnnm1, foreign_code, pnt_des, des, eccn_no, entity_no,
    odtc_cert_ind, dep_date, equipment_no, haz_flag, schd_no,
    schd_desc, rec_value, iso_ulti_dest, odtc_exempt, itn,
    liscence_no, liscence_flag, liscence_code, mblno, mot,
    cntry_load, pnt_load, origin_state, airline_prefix, qty1, qty2,
    ref_val, related, routed_flag, scac, odtc_indicator, seal_no,
    line_no, port_export, port_unlading, shipnum, shprnm1, veh_title,
    total_value, odtc_cat_code, unit1, unit2)
    SELECT 49, schemaP.tableS.shpdt, schemaP.tableS.blno,
    schemaP.tableS.stt, schemaP.tableS.shpr_nad,
    schemaP.tableM.branch_tableS, schemaP.tableS.csgn_nad,
    schemaP.tableS.csgnnm1, schemaP.tableD.foreign_code,
    schemaP.tableS.pnt_des, schemaP.tableS.des,
    schemaP.tableD.eccn_no, schemaP.tableN.entity_no,
    schemaP.tableD.odtc_cert_ind, schemaP.tableM.dep_date,
    schemaP.tableM.equipment_no, schemaP.tableM.haz_flag,
    schemaP.tableD.schd_no, schemaP.tableD.schd_desc,
    schemaP.tableD.rec_value,
    schemaP.tableM.iso_ulti_dest,
    schemaP.tableD.odtc_exempt, schemaP.tableM.itn,
    schemaP.tableD.liscence_no,
    schemaP.tableM.liscence_flag,
    schemaP.tableD.liscence_code, schemaP.tableS.mblno,
    schemaP.tableM.mot, schemaP.tableS.cntry_load,
    schemaP.tableS.pnt_load, schemaP.tableM.origin_state,
    schemaP.tableM.airline_prefix, schemaP.tableD.qty1,
    schemaP.tableD.qty2,
    schemaC.func_getRefs@link (schemaP.tableS.ptt, 'ZYX'),
    schemaP.tableM.related, schemaP.tableM.routed_flag,
    schemaP.tableM.scac, schemaP.tableD.odtc_indicator,
    schemaP.tableM.seal_no, schemaP.tableD.line_no,
    schemaP.tableM.port_export,
    schemaP.tableM.port_unlading, schemaP.tableS.shipnum,
    schemaP.tableS.shprnm1, schemaP.tableV.veh_title,
    schemaP.tableM.total_value,
    schemaP.tableD.odtc_cat_code, schemaP.tableD.unit1,
    schemaP.tableD.unit2
    FROM schemaP.tableD@link,
    schemaP.tableM@link,
    schemaP.tableN@link,
    schemaP.tableS@link,
    schemaP.tableV@link
    WHERE tableM.answer IN ('123', '456')
    AND SUBSTR (tableS.area, 1, 1) IN ('A', 'S')
    AND entity_no IN
    ('A',
    'B',
    'C',
    'D',
    'E',
    AND TO_DATE (SUBSTR (tableM.time_stamp, 1, 8), 'YYYYMMDD')
    BETWEEN '01-Mar-2009'
    AND '31-Mar-2009'
    AND tableN.shipment= tableD.shipment(+)
    AND tableN.shipment= tableS.shipnum
    AND tableN.shipment= tableM.shipment(+)
    AND tableN.shipment= tableV.shipment(+)
    <SQL>
    Edited by: user11263048 on Jun 12, 2009 7:23 AM
    Edited by: user11263048 on Jun 12, 2009 7:27 AM

    Can you change this:
    BETWEEN '01-Mar-2009'
    AND '31-Mar-2009'To this:
    BETWEEN TO_DATE('01-Mar-2009', 'DD-MON-YYYY')
    AND TO_DATE('31-Mar-2009','DD-MON-YYYY')That may make no difference but you should never rely on implicit conversions like that, they're always likely to cause you nasty surprises.
    If you're still getting the discrepancy, instead of and INSERT-SELECT, can you try a CREATE TABLE AS SELECT... just to see if you get the same result.

  • Jdbc sql insert to oracle DB.

    Dear All,
    I'm using the jdbc connector to insert data directly into an Oracle database table.  I've got the SQL insert command which XI has generated by using the logSQLStatement parameter and I've proved the statement is good by pasting it directly into Toad where it is executed perfectly.  However XI is throwing the following errors;-
    Unable to execute statement for table or stored procedure. 'SI_ORDER' (Structure 'STATEMENT') due to java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
    MP: exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SI_ORDER' (structure 'STATEMENT'): java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric was expected
    Does anyone know what might be the problem or even where I should start to troubleshoot this?
    Any help is much appreciated.
    Pete.

    Your question is how to load data from a text file into arrays?
    Start with a
    StreamReader to read the file one line at a time.  Then break each line into individual values, and add each value to a
    List<T>.  Then call .ToArray() on each list to set the value of each array-bound parameter.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • SQL insert scripts generation from repository data xml file

    Hi All,
    I want to generate sql insert scripts from repository data xml file which contain <add-item>elements.
    Example: data xml file is contains
    <add-item item-descriptor="user" id="741">
    <set-property name="gender"><![CDATA[female]]></set-property>
    <set-property name="emailStatus"><![CDATA[__NULL__]]></set-property>
    <set-property name="receiveEmail"><![CDATA[__NULL__]]></set-property>
    <set-property name="email"><![CDATA[[email protected]]]></set-property>
    <set-property name="password"><![CDATA[a694cb1d6d011eddc444acb77338c1df6a22bac5de26330e2fe1d20f15f97ed6]]></set-property>
    <!-- rdonly derived <set-property name="abandonedOrderCount"><![CDATA[0]]></set-property> -->
    <set-property name="locale"><![CDATA[de_DE]]></set-property>
    <set-property name="userType"><![CDATA[1]]></set-property>
    <set-property name="autoLogin"><![CDATA[__NULL__]]></set-property>
    <set-property name="lastName"><![CDATA[Springford]]></set-property>
    <set-property name="member"><![CDATA[true]]></set-property>
    <set-property name="dateOfBirth"><![CDATA[7/18/1951 00:00:00]]></set-property>
    <!-- rdonly derived <set-property name="age"><![CDATA[61]]></set-property> -->
    <set-property name="registrationDate"><![CDATA[5/16/1996 00:00:00]]></set-property>
    <set-property name="login"><![CDATA[sally]]></set-property>
    <set-property name="lastActivity"><![CDATA[6/9/1999 00:00:00]]></set-property>
    <set-property name="homeAddress"><![CDATA[741]]></set-property>
    <set-property name="passwordSalt"><![CDATA[sally]]></set-property>
    <set-property name="generatedPassword"><![CDATA[__NULL__]]></set-property>
    <set-property name="firstName"><![CDATA[Sally]]></set-property>
    <set-property name="lastPasswordUpdate"><![CDATA[__NULL__]]></set-property>
    </add-item>
    Thanks
    Siva

    HI Rohan,
    Thanks for reply..
    I have checked the startSQLRepository script by using this we can export or import repository data from xml to repository.But in startSQLRepository there is no attribute to generate sql
    insert scripts from data xmls but there is a option to get the sql scripts(-ouputSQL).

Maybe you are looking for

  • For  SOAP Adapter

    HI Friends, i getting gold  value from file i need to update the value in webservice for every second in website.So how to update the value  dynamicallly  in websystem using soap adapter receiver is file adapter is there any options in soap adapter

  • How to count the elements in a Source whith method count() ?

    hi all, I have a Source created by: Source s = m1.join(m2).join(m3).join(d1).join(d2); m1, m2, m3: MdmMeasure of the same Cube C1 d1, d2: MdmPrimaryDimension of the same Cube C1 I want to count the elements in this Source that have values so I used:

  • Installing Solaris 10 On HP ML 350 G5

    I have a problem when installing solaris 10 on HP Proliant ML350 G5, it says no disks found, I have smart array controller E/200 from HP, i downloaded the driver and followed the steps for updating driver during installation of solaris 10, but i stil

  • Illustrator and Lightroom probs

    I have bought cloud, installed and Indesign & photoshop work, but Illustrator loads, almost opens, menus come up, then crashes and gives heaps of code in crash report - Lightroom does the same - WTF? I haven't tried other programs yet but 4 tried, 2

  • Lwp_sea_wait hang

    Hi - can anyone help please ! I have a large program that hangs on exit. The optimized (-fast) version has the problem - the non-optimized version does not. I believe the code is calling the destructor for a std::set< std::pair< enum, std::string > I