How to  update database  HELP

Hi All
I need to update the database with variable so I can't to use below statement
stmt.addBatch("INSERT INTO COFFEES " + "VALUES('Amaretto', 49, 9.99, 0, 0)");
Anyone can teach me which method I can use instead of above statement
Thanks

Hi,
if you wanna update your db with variables... you have to use Prepared statement ... i am sure that there is a tutorial on the java website
bye

Similar Messages

  • How to update database table !!!

    hi all,
    Please advice how to update database table with certain cndition needs to be checked.
    Please consider below scenario.
    have used enqueu and dequeue function to lock entries  and also i have used BAPI so considering that return parameter . i want to update table
    /tdk/st0027.
    1. I want to update database table
    2. there are certain condition needs to be checked like ,
       loop at it_final into wa_final.
    th_return-type = 'S'.
               if th_final-vbeln = /tdk/st0027-vbeln and
                  th_final-posnr = /tdk/st0027-posnr and
                  th_final-etenr = /tdk/st0027-sdslno.
    above condition which i need to check .and need to append below system fields need to be appended in table.
              th_final-prstsind = '20'.
              th_final-chgdate  = g_date.
              th_final-chgtime  = g_uzeit.
              th_final-chgprog  = g_cprog.
              th_final-chguser  = g_uname.
              append th_final to td_final.
              update /tdk/st0027 FROM th_final.
              endif.
    endloop.
    but i am getting error saying that  "The type od database table and work area (TH_FINAL)  are not unicode convertible"?
    I am not able to understandwhat would be the solution for this ?
    Thanks and regards,
    Prasad K. NAralkar

    The error occurs in the UPDATE statement included in the code. In this statement it is seen that there is a mismatch of structure defined for the DDIC table /tdk/st0027 and that of your work area th_final.
    try to create a structure w.r.t the DDIC table.
    Eg: DATA: wa_temp TYPE /tdk/st0027.
    MOVE-CORRESPONDING th_final TO wa_temp.
    Then try to UPDATE using the temporary work area i.e wa_temp which has structure similar to that of the database table.

  • How to update database using Service in 11g

    Please some one provide the knowledge, how i will update database from a form and form is having multiple rows and column and and all are having different or same value.
    e.g. we have having clientName table and having column(clientname, legalContact, selfservice,usertype,details),
    We can search the data from clientName, now user can change other information except clientName can not be change but other information can change. now how i will update users changed value.

    Hi ,
    If you are looking to update the fields for a user such as description , telephone number etc then the following service needs to be used :
    UPDATE_USER_META_TABLE
    Details for this are available in : http://docs.oracle.com/cd/E23943_01/doc.1111/e11011/c04_core.htm#CSSRG2503
    Hope this helps .
    Thanks,
    Srinath

  • How to update database in update task

    Hi everyone,
      I have a question: I need to update database in a SAP LUW. And I develop a method in my class
    to update the database.how can I update database in SAP LUW.

    Use can use "COMMIT WORK " and Database operate command SQL
    Within an LUW, database changes are not made until after a database commit. Prior to this, any database change can be canceled by a database rollback.
    In the R/3 System, a database commit is triggered either automatically or by the ABAP/4 command COMMIT WORK or the appropriate Native SQL command for the database system.
    Similarly, a database rollback is triggered either automatically or by the ABAP/4 command ROLLBACK WORK or the appropriate Native SQL command for the database system.
    After the COMMIT WORK has been executed, the event RAISE_TRANSACTION_FINISHED of the class CL_SYSTEM_TRANSACTION_STATE with parameter value CL_SYSTEM_TRANSACTION_STATE=>COMMIT_WORK is triggered. However, this does not apply to the COMMIT WORK at the end of the update.
    Edited by: Jack Wu on Dec 16, 2008 11:13 AM

  • How to Update Plz Help Me

    I want to know that how to update the FW of my nokia N95 through The internet (ONLINE)
    there is the profile setting  present in my nokia n95 
    Menu--> Tool-->Utilities-->Device Mgr
    and there in Device mgr profile setting is present so plz tell that what should i do 
    Server Name????
    Server ID????
    server Password???
    seesion mode????
    Access point???
    Host address???
    Port???
    User Name???
    Password???
    Allow configuration???
    Auto-accept????
    Network aythentic???
    what should i do and what should write in these parameter which is mention above
    thanks 

    There two ways to update/upgrade your phone firmware. By NSU, pc running pcsuite connected to your phone; and by FOTA or over the air if supported by your provider. Don't bother with that parameters, just request from your provider the setup/configuration for data e.g 3g, gprs, mms ect. or you can go to Nokia for it. Data access must be activated & running to avail for FOTA. Get the product code of your phone(written in the box) or, under the battery compartment, for it will ask for that if there is an upgrade available in your area.
    Download the latest version of pcsuite for your phone, then install it to your pc/laptop and connect your phone via cable (recommended), when connection is established, select from the menu software update. You should have internet connection with that pc.
    In over the air(FOTA), connection via 3g (recommended, faster) just look in the menu for software update, it will prompt you what to enter. Data services that I mentioned above should be activated, supported & tested running, else no go.
    Message Edited by android on 17-Sep-2009 03:36 PM
    Knowledge not shared is knowledge wasted!
    If you find it helpfull, it's not hard to click the STAR..

  • How to update database with a select box

    I'm hoping someone can/will help me with a new feature I'm
    trying to add to my web site. I'll summarize what I'm working with
    and then proceed to what I'd like to do. This is the web site I'm
    working on: www.truckerstoystore.net
    I have a database for the Truck of the Week set up with the
    information that is output on each page in the left column and
    on the Truck of the week page itself. I add new Truck of the
    Week (TOW) entries via a form I've put together. Right now, in
    order to change the current TOW, I have to manually go into my
    template and change the ID (which is automatically assigned when
    the record is created, and thus makes it unique) in my SQL which
    currently reads
    SELECT *
    FROM truckofweek
    WHERE ID="4"
    to the ID of the current TOW.
    What I want to be able to do is create a new form that will
    allow me to select the TOW entry that I want to be displayed from a
    select box (drop down box). I have a good idea of how to populate
    my select box, but don't know how to get it to work. My first idea
    was to update the table in the database (Access) manually with a
    new column called currentTOW, with values set to a Yes/No type,
    with default values set to "No". Then I would use my form to set
    the value for one of them to "Yes" so I could set my SQL to 'WHERE
    currentTOW ="yes" ' I would also make a <cfif> statement that
    checks for entries marked "Yes" and changes them to "No" when the
    form loads to avoid setting 2 entries to "Yes" and my page thus
    attempting to load 2 TOW entries.
    My problem is, I don't know how to do any of this. I hope
    I've described this situation well enough. I know there has to be
    at least one guru on here that can help me. Any assistance would be
    greatly appreciated.

    Hey,
    Thanks for replying. That sounds like a good idea, but I
    don't know how to do it.
    I started working on a new idea, where I have a second table
    in the same datasource set up called currentTOW, with one field
    called currentTOW and only one record. The idea is to send the
    string of the "owner" field from the select box, which is populated
    from the table called truckofweek to this one cell in the
    currentTOW table.
    This way, in my page which will display the data, I have 2
    querys. The first pulls the data in the single cell from currentTOW
    and outputs its string into the second query. I've attached the
    code below. I get an error when I try to display the page, see the
    error here:
    www.truckerstoystore.net/currentTOW2.cfm.
    However, the SQL looks like I want it to look, as "WHERE Owner =
    Craig Carp" is essentially the same record that it displays now in
    the live page "/currentTOW.cfm" only the SQL currently reads "WHERE
    ID = 4" (4 and Craig Carp are part of the same record).
    Here is the link to my form:
    Form

  • How to update Search Help template for ITS Service PZ03

    Hi all,
    There is a requirement to change the search help screens of pz03 Internet Service which is being used with EP 7.0.
    I have little experience in  ABAP so can anyone let me know how to change it. I was able to reach SEARCHHELPDHTML template. Is there a place I can download the template and update it.
    Please reply fast. Points assured.
    Regards
    Atul

    Hi.
    If you define an Internet Service, using SICF transaction, it shows all standard and z's search help, so I think it's not an ITS problem. Try to define your search help normally on R/3, an after that define your service with using new transaction.
    Best regards.

  • How to update database table with this new internal table

    hi
    i have a internal table having 8 records and it contains one record which was modified by user
    not i want this new record to be updated to the database table which was modified by the user
    how to do it pls suggest?
    i want to use index for comarision as using index will not have any problems like promary key etc
    like i want to capture the index for this table which was modified thr recoed index and use thi record indext to modify the database table
    or any other suggestion
    regards
    nishant

    Hi Nishant,
    Have an additional field in a table to indicate a change with which you avoid in updating the record modified by user.
    Regards,
    Madhu.

  • How to update database

    First, i retrieve 'PartID' from Temp tbl,
    then i need to retrieve 'WIP' from Trak_Wip tbl with that particular 'PartID',
    then update "WIP' in Temp tbl
    this is Temp tbl,
    Temp tbl (PartID, Qty, WIP)
    Below is my code,
    {code}
    <sql:query var="rs" dataSource="${connection}">
    SELECT * FROM Temp
    </sql:query>
    <c:forEach var="row" items="${rs.rows}">
    <c:set var="partId" value="${row.PartID}"/>
    <sql:query var="rsWip" dataSource="${lperf}">
    SELECT SUM(Trak_Wip.Curr_Oper_Qty) as sum
    FROM Trak_Wip
    WHERE (Trak_Wip.Wip_Bank='DDBV' or Trak_Wip.Wip_Bank='SDBV' or Trak_Wip.Wip_Bank='S200') andTrak_Wip.Target_Item=?
    <sql:param value="${partId}"/>
    </sql:query>
    <c:forEach items="${rsWip.rows}" var="row">
    <c:set var="Wip" value="${row.sum}"/>
    <sql:update dataSource="${connection}" var="rsUpdateWip">
    UPDATE Temp SET WIP=? WHERE PartID=?
    <sql:param value="${Wip}" />
    <sql:param value="${partId}" />
    </sql:update>
    </c:forEach>
    </c:forEach>
    {code}
    {noformat}this is the error,
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException:
                   UPDATE Temp SET WIP=? WHERE PartID=?
              : [Microsoft][ODBC Microsoft Access Driver]Invalid SQL data type
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    {color:#ff0000}Can anyone solve my problem?
    {color}
    {noformat}

    Start with not using the JSTL SQL taglibrary. Write a DAO class which does the database access tasks and then come back if you still stucks.

  • How to update database table from Internal Table

    hi experts,
        Can anyone please assist me in inserting records to a database table from an Internal Table
    whose structures are identical.
    Thanks in Advance,
    Sudhaa............

    Hi Sudha,
    Here are some example of update and insert:
    UPDATE SFLIGHT SET PLANETYPE = 'A310'
    PRICE = PRICE - '100.00'
    WHERE CARRID = 'LH' AND CONNID = '0402'.
    This example overwrites the contents of the PLANETYPE column with A310 and decreases the value of the PRICE column by 100 for each entry in SFLIGHT where CARRID contains u2018LHu2019 and CONNID contains u2018402u2019.
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    MOVE 'AA' TO WA-CARRID.
    MOVE '0064' TO WA-CONNID.
    MOVE 'WASHINGTON' TO WA-CITYFROM.
    UPDATE SPFLI FROM WA.
    MOVE 'LH' TO SPFLI-CARRID.
    MOVE '0017' TO SPFLI-CONNID.
    MOVE 'BERLIN' TO SPFLI-CITYFROM.
    UPDATE SPFLI.
    CARRID and CONNID are the primary key fields of table SPFLI. All fields of those lines where the primary key fields are "AA" and "0064", or "LH" and "0017", are replaced by the values in the corresponding fields of the work area WA or the table work area SPFLI.
    DATA: ITAB TYPE HASHED TABLE OF SPFLI
    WITH UNIQUE KEY CARRID CONNID,
    WA LIKE LINE OF ITAB.
    WA-CARRID = 'UA'. WA-CONNID = '0011'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'LH'. WA-CONNID = '1245'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'AA'. WA-CONNID = '4574'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    UPDATE SPFLI FROM TABLE ITAB.
    This example fills a hashed table ITAB and then overwrites the lines in SPFLI that have the same primary key (CARRID and CONNID) as a line in the internal table.
    Insert statement :
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    WA-CARRID = 'LH'.
    WA-CITYFROM = 'WASHINGTON'.
    INSERT INTO SPFLI VALUES WA.
    WA-CARRID = 'UA'.
    WA-CITYFROM = 'LONDON'.
    INSERT SPFLI FROM WA.
    SPFLI-CARRID = 'LH'.
    SPFLI-CITYFROM = 'BERLIN'.
    INSERT SPFLI.
    If the database table does not already contain a line with the same primary key as specified in the work area, the operation is completed successfully and SY-SUBRC is set to 0. Otherwise, the line is not inserted, and SY-SUBRC is set to 4.
    Regards,
    Premraj kaushik

  • How to update the Help Files

    Hi Team,
    I am in the process of creating a customized help file.
    In the All Projects Tab,under Help Menu can I go and replace the existing pdf downloads with the customized help files?.If yes ,then kindly let me know  the steps.
    Regards,
    Avinash

    You do this in the BP Setup of the BP in question.  So, if this BP lives in the All Projects shell, you could navigate to that shell and switch to Admin mode.  if it is in a Project under that shell, you can navigate to that project and switch to Admin mode.  Then, go to Setup > Business Process.  Open the desired BP and open the general BP setup. You should see a Help File field in the General tab. Remove the existing file and add a new file, as desired.
    This will add the file for that particular shell instance only, so if you want this to be the new help file for all instances of that shell, you can follow the procedure above for a shell template of that type, then update the shells.
    Sean

  • How to update Community Help Client?

    On one of my PCs, the Community Help Client was updated to a version which (finally) supports Ctrl+F. However, my other PC is still on the old version and I can't find a download package / update site that would help me update. Any hints?
    Thanks,
    Borek

    You can update it from here: http://www.adobe.com/support/chc/
    Stephen

  • How to update database table with key field?

    Hello Experts,
    I have a database table with following fields
    MATNR   - Key
    SSOUR  -  Key
    KUNNR   - Key
    MENG1 
    MENG2
    MENG3
    And this table contains records like...
    MSD50001     R      1000001     5.30    2.30    5.25
    MSD50002     R      1000002     5.30    2.30    5.25
    MSD50003     R      1000003     5.30    2.30    5.25
    MSD50005     R      1000004     5.30    2.30    5.25
    MSD50004     R      1000005     5.30    2.30    5.25
    I have an internal table with same fields of above database table.
    MSD50001     A      1000001     5.30    2.30    5.25
    MSD50002     A      1000002     5.30    2.30    5.25
    MSD50003     A      1000003     5.30    2.30    5.25
    MSD50005     A      1000004     5.30    2.30    5.25
    MSD50004     A      1000005     5.30    2.30    5.25
    MSD50006     A      1000006     5.30    2.30    5.25
    I want to update the DB table with following internal table records.
    If internal table records = db table records are same then Update....else insert from internal table to db table.
    But here, SSOUR is key field so i am not able to use
    MODIFY dbtab from itab.
    It results me , entries in internal table are inserted into db table.
    So i have double records.
    Is there any statement which updates the key field? and if no fields in db table then insert it?
    Regards
    RH

    hi,
    u cannot update akey field.u can update only non key fields by using key field as a selection criteria.For example if u go to sm30 if u enter any table for inserting values, the key field will always be greyed out it is not succumbed to chnges.but u can insert value into ,if ur inserting and in the insert staemnet if  u have key field which is already present in the table it will return sy-subrc = 4 otherwise it will insert the record and return 0.
    eg for update :
    UPDATE zdm_wtyprof  SET upload_status = 'S'
                             WHERE spart = wa_upd-spart.
    here spart is the key field and it will update the status field in the table as S.
    if updated succesfully it will return 0.
    SIMILARLY U CAN USE select.

  • How to update database table in jdeveloper 10g

    I currently have a roles table, usersinroles table, and a users table. The users table has a user ID, the roles table has a Role ID, and the usersinroles table has Role ID and user ID as foreign keys. I can add new users, but how can I implement the ability to add a role to the user and it store the USER ID of that particular user and the ROLE ID of the role I choose in the usersinroles table??
    Thanks,
    Adam

    I'm not sure I understand your question here.
    If you have EOs for each one of the three tables with master-detail associations from the user and role tables to the cross table, then you can create a master/details form showing a user and all his roles and then adding a record to the crosstable will automatically add the userid correctly.

  • HT5052 i have iphone 3g simple. when i open itunes then screen appear ios 5 is required, i dont knw how to update, plz help me out

    pls help me out

    An iPhone 3G can NOT be upgraded to iOS 5. Where are you seeing this message?
    Stedman

Maybe you are looking for

  • Is Cool 'n Quiet stable?

    I run a K8N Neo2 Platinum (MS-7025) with 1.4 bios, 3800+ NewCastle CPU and Kingston HyperX 400MHz memory. The setup works like a charm, but when I enable "Cool 'n Quiet" it seems to cause lock-ups and reboots. The system is NOT overclocked, everythin

  • ITunes 10.6.3.25 problems

    After updating to 10.6.3.25 I'm having all kinds of problems... On running iTunes I get the error message "A required iTunes component is not installed. Please reinstall iTunes. (-42404)" However it runs... Kind of... When I try to update an app I ag

  • Why are iCal alarms coming up with a black rectangle?

    Why are iCal alarms coming up with a black rectangle? I'm running 10.3.9 and iCal v. 1.5.2. This started after I did software updates this week. iMac   Mac OS X (10.3.9)  

  • I just bought a refurbished Ipod 3rd generation 8 gigs, but when I enter the serial number into Apple's site, it shows up as a 2nd generation. Is this normal?

    I bought a refurbished Ipod touch, 3rd gen(link: http://store.apple.com/ca/product/FC086LL/A?mco=MjI4NjY2MTE) The home button broke on me, so while setting up servicing for it, when I entered the serial number into the Apple site, my supposedly "3rd

  • Apple ID on App store NOT mine.

    I am trying to sign onto my app store. It is giving me an email that is not even mine to sign into. In my settings, it is saying my correct email. Then I go into the app store and this email pops up again and I'm not able to change it! I HELP! I have