BSP with SQL insert statement

Hi all,
I'm creating a BSP page with 2 inputfields and 1 submit button...
first inputfield should contain a table+field name and the second inputfield must contain a value that has to be written in the table of field1.
When I press the submitbutton, I want the value from the second inputfield to be written into the corresponding field of inputfield 1.
Currently I have the following:
<htmlb:inputField id         = "field1"
                        type       = "string"
                        doValidate = "TRUE"
                        maxlength  = "50"
                        size      = "50"
                        value      = "<%= table_name %>" />
<htmlb:inputField id         = "field2"
                        type       = "string"
                        doValidate = "TRUE"
                        maxlength  = "50"
                        value      = "<%= table_value %>" />
<htmlb:button text    = "Save value"
                    id      = "submit"
                    onClick = "submit" />
Now my question is the following: does anyone have e.g. sample code on how to process sql "oninputprocessing" so that the value from "field2" is inserted into table as entered in "field1" ?
thanks a lot in advance,
of course points will be rewarded ...

Hi Joris,
   Go through this sample code which i am sending you by seeing your requirement. Hope it helps you...
In OnInputprocessing
class cl_htmlb_manager definition load.
if event_id = cl_htmlb_manager=>event_id.
   data event type ref to cl_htmlb_event.
   event = cl_htmlb_manager=>get_event(
                runtime->server->request ).
   if event->name = 'button' and event->event_type = 'click'.
       data data1 type ref to cl_htmlb_inputfield.
       data1 ?=  cl_htmlb_manager=>get_data(
                  request = runtime->server->request
                  name = 'inputfield'
                  id   = 'field'
       if data1 is not initial.
            v_field = data1->value.
           append v_field to it_mara1.
        endif.
    endif.
layout
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
  <htmlb:page title = "first page ">
    <htmlb:form>
     <htmlb:tableView id="table" table="<%= it_mara1 %>"></htmlb:tableView>
     <htmlb:inputField  id="field" />
      <htmlb:button       text          = "Press Me"
                          onClick       = "myClickHandler" />
    </htmlb:form>
  </htmlb:page>
</htmlb:content>
Page attributes
it_mara1     type    it_mara
v_field      type    mara-matnr
Type Definitions
Types : begin of t_mara,
        matnr type matnr,
        end of t_mara.
Types it_mara type table of t_mara.
Regards,
Azaz Ali.

Similar Messages

  • SQL Insert Statement Data Type Mismatch Error

    I am doing a very simple web application that has a Microsoft Access database as the data source. I have been able to sucessfully create update and query statements using parameters but am having issues with an insert statement. I am using JSTL 1.1.2
    The following code creates the data type mismatch error.
    <sql:update
         sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
            <sql:param value='$(ID}'/>
         <sql:param value='${feature}'/>
            </sql:update>The table has NUMBER as the data type for both of these fields and the variables I am feeding into it are both numbers. If I hard code the first number into the sql statement then it works. I have tried swapping the variables around and as long as the first one is hard coded the parameter for the second one works no matter which is first or second.
    However I can get the following code to work, which of course leaves me vulnerable to sql injection attacks which is not really a good thing.
    <sql:update>
         insert into tblTtoF(TFToolID,TFFeatID) values('<c:out value="${ID}"/>','<c:out value="${feature}"/>')
            </sql:update>So I am just looking for any suggestions as to why my first piece of code doesn't work seeing as it is the simplest of SQL statements and the most standard syntax.
    Thanks

    I changed it to the following
         <c:set var="featurenew" value="${0 + feature}"/>
         <c:set var="IDnew" value="${0 + param.toolID}"/>
              <sql:update
              sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
              <sql:param value='$(IDnew}'/>
              <sql:param value='${featurenew}'/>
              </sql:update>And got the following error in the localhost.log
    31/07/2006 09:31:41 org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.sql.SQLException: SQL Exception : [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1437)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1072)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1063)
         at org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.setParameters(UpdateTagSupport.java:254)
         at org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.doEndTag(UpdateTagSupport.java:156)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_sql_update_1(dataUpdated_jsp.java:975)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_c_if_0(dataUpdated_jsp.java:879)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_c_forEach_0(dataUpdated_jsp.java:680)
         at org.apache.jsp.dataUpdated_jsp._jspService(dataUpdated_jsp.java:151)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
         at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
         at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
         at java.lang.Thread.run(Thread.java:595)
    I have also tried the following in the past with no luck
    <fmt:parseNumber value="${ID}" type="number" var="IDnew"/>
    AND......
    <sql:query
       sql="select TFToolID from tblTtoF where TFToolID = ?"
       var="toolresults">
       <sql:param value="${ID}"/>
    </sql:query>
    <c:forEach var="getID" items="${toolresults.rows}">
         <c:set var="theID" value="${getID.TFToolID}"/>
    </c:forEach>
    AND when that didn't work, added this....
    <fmt:parseNumber value="${theID}" var="IDnew"/>

  • Generate SQL Insert Statements

    Hello,
    I am testing generating insert statements for which I have a function which will return a sql statement.
    This sql statement when I execute would results as sql insert statements.
    What I am trying to acheive through a procedure is when I execute function, the result I would like to execute automatically and then the second sql I would like to store to a control file or sql file.
    How can I acheive this?
    Any help is very helpful
    Regards
    Edited by: user20090209 on Aug 20, 2009 11:34 AM

    Here is the function to generate sql
    CREATE OR REPLACE function insert_sql(v_table_name varchar2)
    return varchar2 as
    b_found boolean := false;
    v varchar2(32000);
    v1 varchar2(32000);
    v2 varchar2(32000);
    begin
    for s in (
    select *
    from all_tables
    where table_name=upper(v_table_name)
    --and owner=upper(v_owner)
    ) loop
    b_found := true;
    for ss in (
    select *
    from all_tab_columns
    where table_name = s.table_name
    order by column_id
    ) loop
    if ss.data_type='NUMBER' then
    v1:=v1||','||ss.column_name;
    v2:=v2||',''''''||to_char('||ss.column_name||')||''''''';
    end if;
    if ss.data_type in ('VARCHAR2','CHAR') then
    v1:=v1||','||ss.column_name;
    v2:=v2||',''''''||replace(replace('||ss.column_name||','''''''',''''''''''''),''&'','''')||''''''';
    end if;
    if ss.data_type='DATE' then
    v1:=v1||','||ss.column_name;
    v2:=v2||',to_date(''''''||to_char('||ss.column_name||',''dd.mm.yyyy hh:mi:ss'')||'''''',''''dd.mm.yyyy hh:mi:ss'''')';
    end if;
    end loop;
    v:='select ''insert into '||s.table_name||' (';
    v:=v||substr(v1,2,9999)||') '||chr(10)||' values ('||substr(v2,2,9999)||'); '' txt from '||s.table_name;
    end loop;
    if not b_found then
    v:='- Table ' || v_table_name || ' not found';
    else
    v:=v;
    end if;
    return v;
    end;
    /And I am calling like
    CREATE OR REPLACE PROCEDURE test_gen_script_exec IS
    type v_ref_cur is REF CURSOR;
    v_ref_cur_var v_ref_cur;
    v_temp_sql VARCHAR2(4000);
    v_sql varchar2(4000);
    begin
    v_sql := insert_sql('table_name');--change here
    open v_ref_cur_var for v_sql;
    loop
    fetch v_ref_cur_var into v_temp_sql;
    exit when v_ref_cur_var%notfound;
    execute immediate v_temp_sql;
    end loop;
    close v_ref_cur_var;
    end;
    /Edited by: user20090209 on Aug 20, 2009 1:24 PM

  • 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

  • Problem with SQL Insert

    Hi
    I am using Flex to insert data through remoteobject and using
    SAVE method generated from CFC Wizard.
    My VO contains the following variables where id has a default
    value of 0 :
    public var id:Number = 0 ;
    public var date:String = "";
    public var accountno:String = "";
    public var debit:Number = 0;
    public var credit:Number = 0;
    id is set as the primary key in my database.
    I have previously used MySQL which automatically generates a
    new id if I either omitted the id value in my insert statement or
    use 0 as the default value.
    However, now I am using MS SQL Server and the insert
    generated this error:
    Unable to invoke CFC - Error Executing Database Query.
    Detail:
    [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert
    explicit value for identity column in table 'Transactions' when
    IDENTITY_INSERT is set to OFF.
    Strange thing is that I dont see this problem with another
    sample application. I compared with that application (it has the
    same VO with default value of 0 for id) and everything looks
    similar so I can't understand why I have this error in my
    application.
    This is SQL used to create the table:
    USE [Transactions]
    SET ANSI_NULLS ON
    SET QUOTED_IDENTIFIER ON
    SET ANSI_PADDING ON
    CREATE TABLE [dbo].[Transactions](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [date] [datetime] NULL,
    [accountno] [varchar](100) NULL,
    [debit] [int] NULL,
    [credit] [int] NULL,
    CONSTRAINT [PK_Transactions] PRIMARY KEY CLUSTERED
    [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE =
    OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
    ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Has anyone encountered this problem before with insert
    statements dealing with a unique id (with MS SQL Server)?

    Change "addRecords =
    connection.prepareStatement("
    to "addRecords =
    connection.preparedStatement("
    -BIGD

  • Improving SQL Insert statement syntax

    It's about insert statement syntax, in insert statement, unlike in update statement column names and corresponding values are separated in two different sets. With this separation debugging/writing of insert statement is going to be time taking activity. To identify what value is getting stored in any column, first column position needs to be identified and after that by counting commas in the values list value is located. If functions are included in insert statement then counting of commas doesn't help to locate the value.
    In any non trivial application column count in insert statement is going to be very big number and it is unmanageable.
    If column name and value are written next to each other as it is done in cause of UPDATE statement, it is going to drastically reduce the debugging efforts and there by improves the productivity of the developers.
    So I request SQL community please consider having a variant of insert statement in similar lines of update statement. This will simplify the life of millions of developers.
    Edited by: user9110509 on Feb 6, 2010 10:19 AM

    Hi,
    That's a good idea! An optional alternate way of specifying the columns would be handy.
    Perhaps the reason it hasn't been done yet is that most people, like those who have responded to this message, do not find the current syntax much of a problem. We can't be sure if your idea "is going to drastically reduce the debugging efforts" until it is available, but my guess is that it isn't.
    One thing I do to make sure the two lists match is to indent the values directly below the column names, like this:
    INSERT INTO emp (empno, ename,   hiredate,                job)
          VALUES (9876,  'OBAMA', TO_DATE ( '20-JAN-2009'
                              , 'DD-MON-YYYY), 'PRESIDENT');If the list is very long, or individual values are very complicated, then I might start with a list of the column names
    INSERT INTO emp          -- Step 1: not ready to run yet
    (     empno
    ,     ename
    ,     hiredate
    ,     job
    VALUESthen use the editor's copy and paste commands to duplicate that list:
    INSERT INTO emp          -- Step 2: not ready to run yet
    (     empno
    ,     ename
    ,     hiredate
    ,     job
    VALUES
    (     empno
    ,     ename
    ,     hiredate
    ,     job
    ;and then fill in the VALUES section, leaving the copied names as comments:
    INSERT INTO emp          -- Step 3: ready to run
    (     empno
    ,     ename
    ,     hiredate
    ,     job
    VALUES
    (     9876               -- empno
    ,     'OBAMA'               -- ename
    ,     TO_DATE ( '20-JAN-2009'
              , 'DD-MON-YYYY
              )          -- hiredate
    ,     'PRESIDENT'          -- job
    ;

  • How to convert XML content into SQL INSERT statements

    Hi all,
    I'm very new to XML. Forgive me if I don't use technical XML terms. :-)
    We are planning to convert SQL queries into XML format using a third party tool.
    After that we have to read the XML files and use the tokens to insert into custom tables.
    So, basically we have to create INSERT statements using the data stored in the XML file.
    How do we go about reading / parsing the XML file in Java?
    Pls help!
    Regards,
    Sam

    This is the requirement with an example.
    eg. if the following SQL query is fed into the 3rd party system,
    select last_name,job_id,salary from employees a, deptno b
    where a.deptno = b.deptno
    the output would be,
    <?xml version="1.0" ?>
    <sqlscript dbvendor="MSSQL">
    <fullselectstmt nestlevel="0">
    <subselectstmt><selectclause><fieldlist>
    <field><fieldname>
    <attr>
    <sourcetoken toketype="" dbobjtype="field">last_name</sourcetoken>
    </attr>
    </fieldname>
    </field>
    <field><fieldname>
    <attr>
    <sourcetoken toketype="" dbobjtype="field">job_id</sourcetoken>
    </attr>
    </fieldname>
    </field>
    <field><fieldname>
    <attr>
    <sourcetoken toketype="" dbobjtype="field">salary</sourcetoken>
    </attr>
    </fieldname>
    </field>
    </fieldlist></selectclause>
    <fromclause><joinlist><join nestlevel="0">
    <lztable><simpletable><attr>
    <sourcetoken toketype="" dbobjtype="table">employees</sourcetoken>
    </attr><aliasclause withas="false"><sourcetoken toketype="" dbobjtype="table alias">a</sourcetoken></aliasclause></simpletable></lztable></join><join nestlevel="0">
    <lztable><simpletable><attr>
    <sourcetoken toketype="" dbobjtype="table">deptno</sourcetoken>
    </attr><aliasclause withas="false"><sourcetoken toketype="" dbobjtype="table alias">b</sourcetoken></aliasclause></simpletable></lztable></join></joinlist></fromclause>
    <whereclause><expression exprtype="Expr_Comparison" exproop="="><attr>
    <sourcetoken toketype="" dbobjtype="table alias">a</sourcetoken>
    <sourcetoken toketype="" dbobjtype="unknown">.</sourcetoken>
    <sourcetoken toketype="" dbobjtype="field">deptno</sourcetoken>
    </attr><attr>
    <sourcetoken toketype="" dbobjtype="table alias">b</sourcetoken>
    <sourcetoken toketype="" dbobjtype="unknown">.</sourcetoken>
    <sourcetoken toketype="" dbobjtype="field">deptno</sourcetoken>
    </attr></expression>
    </whereclause></subselectstmt></fullselectstmt>
    </sqlscript>
    So, using the output file, the list of columns (under token "field") last_name,job_id and salary should be inserted into LIST_COLUMNS table. So 3 INSERT statements should be created for 3 columns.
    The list of tables (under token "table") employees and dept should be inserted into LIST_TABLES table. So 2 INSERT statements should be created for the 2 tables.
    Regards,
    Sam

  • 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

  • Inserting multiple rows with single insert statement ?

    Hi ,,
    Consider a PL/SQL procedure.
    I want to pass an array of values and insert in a table with a single statement.
    Moreover I want to call this procedure to insert multiple rows from OCI program.
    Can some body help ? :(
    Thanks
    Chandu

    Hi Vincent,
    Regular array insert which you have mentioned works in case of insert statement(This is to eliminate multiple calls to server)
    Will it work for passing array to Stored procedure, in this case procedure will be called only once with an array.
    It will be of great help if you give an example.
    Thanks
    Chandra

  • SQL insert statement help please

    alternative is to have the table with field dateadd with default value of getdate()   - then do not include in your insert statement - then the modify date use and update - starting point - my two cetns

    Hi all I'm trying to go a little out of my comfort level here and was hoping for some advice. I have a sql table that has 2 date fields. an add and a modified. If the modified date is null then I want to calculate on the date added. Otherwise I'd like to calculate on the modified date.
    Here is a simplified version of what I'm trying to accomplish.
    Hope it makes sense what I'm trying to do.
    SQLSELECT field1,field2.... ,dateAdded , dateModifiedINTO tblOutputFROM tblInput/* some pseudo code here */WHERE (if dateModified not null then ( dateModified

  • Urgent help needed... PL/SQL Insert statement

    Hi...
    I need some urgent help on this project. I have a 2 column table with values that need to be inserted into another existing table which has a sequence.
    This is the 2 column table:
    FUND YEAR
    29587 05
    29587 07
    Existing table:
    Name Null? Type
    LIST_ID NOT NULL NUMBER(6) -- This is a sequence
    WEB_USER_ID NOT NULL VARCHAR2(10)
    RESOURCE_TYPE NOT NULL VARCHAR2(8)
    LIST_TYPE NOT NULL VARCHAR2(10)
    LIST_NAME NOT NULL VARCHAR2(50)
    LIST_CODE_1 NOT NULL VARCHAR2(6) -- FUND from table above
    LIST_CODE_2 NOT NULL VARCHAR2(6) -- YEAR from table above
    LIST_CODE_3 NOT NULL VARCHAR2(6)
    LAST_UPDATED_DT NOT NULL DATE
    LAST_UPDATED_BY NOT NULL VARCHAR2(10)
    LIST_CODE_4 NOT NULL VARCHAR2(20)
    The columns from table 1 (FUND, YEAR) correspond to columns (LIST_CODE_1, LIST_CODE_2) in table 2. The column LIST_ID is a sequence. I can put in sysdate for LAST_UPDATED_DT and my initials SN for LAST_UPDATED_BY. This is going to be for 2 unique WEB_USER_IDs which would be in the WHERE clause. I will be inserting 2200 rows for each id. A single insert statement would look like this -
    INSERT INTO EXISTING_TBL (list_id,web_user_id,resource_type,list_type,list_name,list_code_1,list_code_2,list_code_3,list_code_4,last_updated_dt,last_updated_by) VALUES ('470027','WEBUSER','GL','FUNDFYF',' FUND BALANCE SUM','12010','01',' ',' ',{ts '2010-5-19 10:16:9'},'SN')
    How would I do this to insert the 2200 values from my 2 column table to the existing table?
    All help is greatly appreciated!!
    SN

    Hello ,
    I think this will work
    INSERT INTO TABLE2
         LIST_ID,
         WEB_USER_ID,
         RESOURCE_TYPE,
         LIST_TYPE,
         LIST_NAME,
         LIST_CODE_1,
         LIST_CODE_2,
         LIST_CODE_3,
         LIST_CODE_4,
         LAST_UPDATED_DT,
         LAST_UPDATED_BY
    SELECT
         SEQ.NEXTVAL,
         FUND,
         YEAR,
         <VALUE FOR RESOURCE_TYPE>,
         <VALUE FOR LIST_TYPE>,
         <VALUE FOR LIST_NAME>,
         <VALUE FOR LIST_CODE_1>,
         <VALUE FOR LIST_CODE_2>,
         <VALUE FOR LIST_CODE_3>,
         <VALUE FOR LIST_CODE_4>,
         SYSDATE,
         'SN'
    FROM
         TABLE1
    REGARDS
    Rahul Sharma

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

  • Looking for some help with building insert statements...

    Hi, I am using some sql to build some insert statements for me to update a set of tables in our qa environments. The scripts that I have created were working great until someone added a column to some of the tables in the qa env which in turn makes my scripts break because I was simply building the statment to do someting like this...
    insert into dest_table (select * from source_table@dblink);
    But now when the coumns in the tables do not match it breaks...
    This is the dynamic create script I use, can anyone help or suggest a better way to be able to build update statements update to qa tables when the columns are mismatched?
    spool insert.sql
    select
    'insert into ' || table_name || ' (select * from ' || table_name || '@prod );' || chr(10) || ' commit;'
    from user_tables
    where table_name in
    (select * from refresh_tablesl)
    any help is greatly appreciated,
    Thanks.

    See my reply to your duplicate post
    looking for help building dynamic insert statements...

  • Error Running SQL Insert Statement with & in it

    Eclipse: 3.5 Galileo on Window Vista
    OEPE: 11gR1 11.1.14
    I get "invalid character" error when running this query in Eclipse:
    INSERT INTO RECIPE (recipeId, name1, name2, recipeCategoryId) VALUES (2, 'Chunky Chicken Egg Rolls', 'No take&ndash;out joint can compare!', 1);
    I've tried multiple ways trying to escape the & character, but nothing worked. What is the right way of executing SLQ via OEPE plugin that have special characters in them.
    FYI, the following worked fine in Oracle 10g iSQL*Plus:
    SET DEFINE ~;
    INSERT INTO RECIPE (recipeId, name1, name2, recipeCategoryId) VALUES (2, 'Chunky Chicken Egg Rolls', 'No take&ndash;out joint can compare!', 1);
    Thanks,
    Dmitri.

    Very interesting case. I tried your insert stmt and got the same error. I finally got it to work by removing the ";" in the end. It looks like the jdbc driver choked up while there is ";" in the middle of the pl/sql statement and ";" in the end. If you remove ";" in the "No take&ndash;out joint can compare!" string and leave the ";" in the end, it also works!
    I don't quite understand why Oracle JDBC dirver behaves like that. I'll investigate it more and we may need to do some preprocessing on the pl/sql statement before sending it to the driver. At the mean time, just remove the ";" in the end if your string literal contains ";".
    Please let me know whether this workaround works for you. Thanks!
    Shenxue

  • Call an sql insert statement in xml publisher

    Hi to all,
    i've a question as regard xml publisher.
    Sorry but i don't have a lot of time to look around.
    This features is quite important and probably would determine if we will use this
    product or not.
    Is possible to call an sql statement when the output is generated?
    example: a user call a report with some par to filter the output (some select list / text, ecc..)
    Or generally can i call use a pl/sql block instead of pl/sql query to populate and at
    the same time to write other data to keep track of the printing / generation of the
    documents X user?
    Otherwise, is xml publisher writing this info in some system table of xml publ?
    Note: i use most of all pl/sql and htmldb and i don't want to use other programming languages until this app is finished.
    Thank you very very much.

    Hi Marcello
    I seem to remember from other threads that you are assessing the enterprise edition of XMLP right?
    If you use the data templates to define how the data should be extracted then you can call a plsql pkg after the fetch to update/insert to your hearts content.
    Otherwise you could use the APIs instead of the UI to do the same or even build an extension to the RTF templates to make the sql call ... we do not document this at the moment but its possible.
    Regards
    Tim

Maybe you are looking for

  • Problem unzipping downloaded Solaris 10 from oracle site

    Hi All, I have a serious problem downloading solaris 10 from the official oracle site. Whenever i want to unzipped the downaloaded zipped file containg the iso DVD solaris the file gets corrupted after a successful downlaod. Is it a problem from the

  • Thinkpad T420, Integrated Graphics, Dual Monitors

    Warning: this isn't really a problem thread. I've looked and looked but can't find a definitive answer for my question. I'm seriously considering a Thinkpad T420 for a new work laptop. I've heard great things from many people, but the most important

  • Problem with arts

    Hi! I use kde 3.5.5. When Kde is going to play the sound with arts, the whole system just hangs for 1,5 seconds. Then sound plays, and everything backs to normal. And it happens every time, the sound is going to be played. When in kcontrol I turn off

  • HT1661 restoring normal mode from target disk mode on imac?Will it do it automatically on restart?

    Booting from a 2002 Imac to a 2003 Imac via forewire. It is reinstalling sys sw as I write this. will 2002 revert to normal mode on restart? or how/what do I need to do? Thanks, Al r.

  • Today's date in mm-dd-yyyy format

    Hi, The default date format in my case is yyyy-dd-mm. I want to pass today's date in the format mm-dd-yyyy to a FM in R3. I have gone through many threads but most talk about changing the format from date to string and vice-versa. Others say that we