What's wrng with my SQL for UPDATE function?

Hi guy..I need help with this Prepared Statement please.It generates an error saying "Syntax errorin SQL"
String sql = "UPDATE Cust_Order SET" +
               " (Costing_Date,Customer,Part_Number,Part_Name,Model_No,Total_Cost,Selling_Price)" +
                " values" + " (?,?,?,?,?,?,?) WHERE ID = "+Dbid+" ";
         PreparedStatement pstm = conn.prepareStatement(sql);
         int col = 1;
         pstm.setString(col++, todate);
         pstm.setString(col++, customer);
         pstm.setString(col++, partNom);
         pstm.setString(col++, partName);
         pstm.setString(col++, modelNom);
         pstm.setString(col++, totalCost);
         pstm.setString(col++, sellPrice);
         pstm.executeUpdate();
stmt.close();
conn.close();
%>

The sql syntax you are using is the one you use for insert statements.
the update syntax looks like
String sql = "UPDATE Cust_Order SET Costing_Date =? , Customer = ?, ... WHERE ID = "+Dbid;        

Similar Messages

  • What's wrong with this SQL?

    what's wrong with this SQL?
    Posted: Jan 16, 2007 9:35 AM Reply
    Hi, everyone:
    when I insert into table, i use the fellowing SQL:
    INSERT INTO xhealthcall_script_data
    (XHC_CALL_ENDED, XHC_SWITCH_PORT, XHC_SCRIPT_ID, XHC_FAX_SPECIFIED)
    VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N'
    FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION
    SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
    I always got an error like;
    VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT,
    ERROR at line 3:
    ORA-00936: missing expression
    but I can't find anything wrong, who can tell me why?
    thank you so much in advance
    mpowel01
    Posts: 1,516
    Registered: 12/7/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:38 AM in response to: jerrygreat Reply
    For starters, an insert select does not have a values clause.
    HTH -- Mark D Powell --
    PP
    Posts: 41
    From: q
    Registered: 8/10/06
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:48 AM in response to: mpowel01 Reply
    Even I see "missing VALUES" as the only error
    Eric H
    Posts: 2,822
    Registered: 10/15/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:54 AM in response to: jerrygreat Reply
    ...and why are you doing a UNION on the exact same two queries?
    (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:55 AM in response to: mpowel01 Reply
    Hi,
    thank you for your answer, but the problem is, if I deleted "values" as you pointed out, and then execute it again, I got error like "ERROR at line 3:
    ORA-03113: end-of-file on communication channel", and I was then disconnected with server, I have to relogin SQLplus, and do everything from beganing.
    so what 's wrong caused disconnection, I can't find any triggers related. it is so wired?
    I wonder if anyone can help me about this.
    thank you very much
    jerry
    yingkuan
    Posts: 1,801
    From: San Jose, CA
    Registered: 10/8/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 9:59 AM in response to: jerrygreat Reply
    Dup Post
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:00 AM in response to: Eric H Reply
    Hi,
    acturlly what I do is debugging a previous developer's scipt for data loading, this script was called by Cron work, but it never can be successfully executed.
    I think he use union for eliminating duplications of rows, I just guess.
    thank you
    jerry
    mpowel01
    Posts: 1,516
    Registered: 12/7/98
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:03 AM in response to: yingkuan Reply
    Scratch the VALUES keyword then make sure that the select list matches the column list in number and type.
    1 insert into marktest
    2 (fld1, fld2, fld3, fld4, fld5)
    3* select * from marktest
    UT1 > /
    16 rows created.
    HTH -- Mark D Powell --
    Jagan
    Posts: 41
    From: Hyderabad
    Registered: 7/21/06
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 10:07 AM in response to: jerrygreat Reply
    try this - just paste the code and give me the error- i mean past the entire error as it is if error occurs
    INSERT INTO xhealthcall_script_data
    (xhc_call_ended, xhc_switch_port, xhc_script_id,
    xhc_fax_specified)
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE'
    UNION
    SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
    hh_switchport, hh_script, 'N'
    FROM tmp_healthhit_load
    WHERE hh_script != 'BROCHURE';
    Regards
    Jagan
    jerrygreat
    Posts: 8
    Registered: 1/3/07
    Re: what's wrong with this SQL?
    Posted: Jan 16, 2007 11:31 AM in response to: Jagan Reply
    Hi, Jagan:
    thank you very much for your answer.
    but when I execute it, I still can get error like:
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    so wired, do you have any ideas?
    thank you very much

    And this one,
    Aother question about SQL?
    I thought I already told him to deal with
    ORA-03113: end-of-file on communication channel
    problem first.
    There's nothing wrong (syntax wise) with the query. (of course when no "value" in the insert)

  • TS1702 Has anybody come up with a solution for updating the apps...!!!????

    Has anybody come up with a solution for updating the apps ....!!!!????

    Yes, I updated all the time.
    What's your problem.

  • What is wrong with Creative Cloud Connection Update

    What is wrong with Creative Cloud Connection Update?  I've tried 25 times to update but it does not work? Can you please help?

    I opened my Adobe Application Manager, and I saw there was an update for Creative Cloud Connection and pressed update. When the installation was at 49% a message came and said: Please close te following applications to continue: - Adobe Creative Cloud Connection. And a buttom: Cncel update or Retry.
    I have Retry 50 times, and it says the same.
    I have restart my computer several times, and the same happened when I come to 49% of the installation.
    What is the problem??

  • Can you see what's wrong with my sql clause?

    Select afkogltri sum( afpowemng ) as yqty
        from   ( afpo inner join afko on afpoaufnr = afkoaufnr )
        into   ( d_gltri , d_wemng )
        where  afpo~matnr = wa_pir-matnr
               and year( afko~gltri ) = year( sy-datum )
        group by afko~gltri. 
    The above is my sql clause, when I do a syntax check, it said:"Comma without preceding colon (after SELECT ?)"
    Can you tell me what's wrong with this sql clause?
    Thank you very much!

    Hi,
    Select Bgltri sum( Awemng ) <b>as yqty</b> (????)
    into ( d_gltri , d_wemng )
    from afpo as A inner join afko as B
    on Aaufnr = Baufnr 
    where A~matnr = wa_pir-matnr
    and year( B~gltri ) = year( sy-datum )
    group by B~gltri.
    ENDSELECT.
    eg<b>:... INTO (f1, ..., fn</b>)
    Places the result set in the target area (f1, ..., fn). The fields of the result set are transported to the target fields fi from left to right. INTO (f1, ..., fn) is allowed only if a list with n elements is also specified in the SELECT clause.
    <b>If the result of a selection is a table, the data is retrieved in a processing loop introduced by SELECT and concluded by ENDSELECT. The processing passes through the loop once for each line read. If the result is a single record, the closing ENDSELECT is omitted.</b>
    Example
    Output a list of all airlines (with short description and name):
    TABLES SCARR.
    DATA:  CARRID   LIKE SCARR-CARRID,
           CARRNAME LIKE SCARR-CARRNAME,
    SELECT CARRID CARRNAME
           INTO (CARRID, CARRNAME)
           FROM SCARR.
      WRITE: / CARRID, CARRNAME.
    ENDSELECT
    Thanks & Regards,
    Judith.

  • TS1702 What is wrong with Pages after the update?

    What is going on with Pages after the update?

    Hey George.iD, you wrote on 6 Feb 2014, this:
    Re: What is wrong with Pages after the update?in response to TRSPAGES
    What's wrong with it?
    As one thing after more-than a month later on 22 March, Pages _refuses_ to alter the color of text.  How maddening this is:  I select text, I select a crayon, but the text _remains_ black.  < Pages is Incorrigible! :-( >
    [After I vented steam, I feel better  --  until later.  What a cycle!  :-) ]

  • Export Quicktime movie is not rendering video track, just the audio track. However, everything works when using Quicktime Conversion menu options. What is wrong with my setting for Export Quicktime movie?

    Export>Quicktime movie is not rendering video track, just the audio track. However, everything works when using Quicktime Conversion menu options. What is wrong with my setting for Export>Quicktime movie?

    When you converted the original files via MPEG Streamclip, what did you convert them to?
    Have you tried trashing your preferences in FCP? Trashing FCP prefs is usually the first step when FCP is performing strangely.
    Download Preference Manager from Digital Rebellion (free) at:
    http://www.digitalrebellion.com/prefman/
    It will allow you to archive your current preferences if you wish to restore them later.
    MtD

  • Sql for sap functional consultant

    Hi sap consultants,
    I have a query related to sql for functional consultant.
    My question is what is the use of sql for functional consultant and what is the future prospect
    after learning it, means will it help in career growth in sap and also to build my candidature strong.
    Please suggest me regarding this.will highly appreciate your replies.
    Thanks in advance.

    Prafulla,
    Have a look at some of the blogs collected under SAP Career Blog Links. Your best route to becoming an SAP Functional specialist is to work your way into the support group of the company in which you already work. Experience is more important than the certificate. Get your experience supporting SAP as an SAP CRM specialist first, THEN get your certificate.
    If you try to do the reverse, you're signing up for a lot of heartache (see blogs in the previous link page). Whatever you do... do NOT quit your job to sign up for training/certification on the hopes that you'll find a job easily after you are certified. End user experience is better than nothing, but does not necessarily "count" as experience when you're trying to get a job for the first time as a functional specialist.
    Only AFTER you've been a specialist for a while does the end user experience add clout to your credentials as you can say " I've experienced the FULL spectrum of SAP" while folks who never had the end user experience seem somewhat lacking by comparison.
    So *eventually*, end user experience + specialist experience + certification = more than the sum of the parts.
    Hope this helps!
    Best regards,
    --Tom

  • I have no idea what to do with the payments for stuff I bought on iTunes.

    Ok I had a card from a rebate atatched to the account and it has just expired. Now itunes wants me to pay from a different card for the things I bought in the week before it expired. I had the amount needed to pay for what i bought on the rebate card and bought my last thing before the card expired because i thought it would be stupid to let the money go without actually using it. I was looking today (it expired overnight) at itunes and now its saying i need to pay for them because the have not been pasyed for yet or something like that and i need to update the billing adress but i cant and dont want to one because i dont want to pay for something i had already had the money to pay for and they didnt charge me on it or something and 2 because i dont have another card to use bc i do not have a credit or checking or any card bc other than the rebate card i only have cash. sorry my question is so long but thank you for all the help you people can give me. ps i cant even get a card bc im 15

    The rebate card that my mom let me use was after they had bought a new phone and try had let me have what was left on it 7.92 and it counted as a visa credit card so I could use it to activate my account the problem is that I bought the stuff before it expired and it is now expired and it's sayin I still need to pay for what I bought with the old card and I don't want to pay twice for the same things that's just stupid I'm goin to get a gift card for the lowest amount so I can still get the free stuff but I don't think I should be responsible to pay for something thy I bought with a card that had the money on it for them to charge bc they debt send out the bill to them when I got the stuff bc there is stuff on it for like Monday saying I need to pay for it when the card didn't even expire till Thursday night

  • Help needed in PL/SQL for updating the column for multiple records

    Hi,
    I am new to PL/SQL and need some help. What is the most effiecient way to update some field in a table as I may need to update thousands of records. I have a coulmn groupid can have multiple records tied to it. All the records attached to some groupid have a priority field also.
    How can I update the prorityfield value for all the groupids in a profiecient way. Here is a sample data
    GroupId     Priority
    1            1
    1            2
    1            3
    1            4
    1            5
    2            1
    2            2
    2            3
    3            1Here I have three groups 1, 2, 3. Now if any group contains only one record the priority remains same e.g. groupid=3 on top. If any group contains more than one record e.g. groupid=1 & 2 I want to re-arrange the priority fields e.g. If I want to update groupid=1 now if I change the priority of 2 to 5 (make it the last) I want to rearrange the remaing records priority i.e. if 2 becomes 5 as I have 5 rows for groupid=1 then 5 becomes 4, 4 becomes 3, 3 becomes 2 and 1 remains the same.
    Same wya if I want to make the priority 1 to 3 for groupid=2 then need 2 to become 1 and 3 to become 2 etc....
    Any help is appreciated.
    Thanks

    Hi,
    You don't need PL/SQL to do this (though you can put the following in PL/SQL if you want to):
    UPDATE     table_x
    SET     priority = CASE
                   WHEN  groupid     = 1
                   AND   priority = 2
                        THEN  5
                   WHEN  groupod     = 1
                   AND   priority     BETWEEN 3 AND 5
                        THEN  priority - 1
                   WHEN  groupid = 2
                   THEN
                        CASE
                             WHEN  prioity = 1
                             THEN  3
                             ELSE  priority - 1
                        END
                 END
    WHERE     groupId          IN (1, 2)
    AND     (     priority     BETWEEN 2 AND 5
         OR     groupid          = 2
         );There are lots of different techniques that can reduce your coidng: for example, the nested CASE statement used for groupid=2 above.
    You could do several smaller UPDATEs (for example, one just for groupid=1). Execution will be slower, but coding and testing will be faster.
    You could make the "magic numbers" 2 (for groupid=1) and 1 (for groupid=2) variables, even outside of PL/SQL.
    If you need more help, post the information that Satyaki requested.

  • When logging on to Hotmail, a window opens asking me "What to do with this file" for "default.aspx"

    This morning, I am unable to log in to Hotmail. The homepage appears normally, but after I enter my email address and password and click to submit them, a window pops us asking me what to do with the file "default.aspx." I have a Vista machine, and last night my computer automatically installed a ton of Microsoft updates. In fact, the update list shows that one of the updates failed to install. At the end of this message, I have pasted the details of the failed update. I have checked the Hotmail support forum, and someone else posted that the have experienced the same problem this morning. The Microsoft "expert" asked him or her to contact Mozilla for support for this issue. Thanks in advance for whatever help you can provide, although I highly suspect that this is a problem on the Microsoft/Hotmail end, not yours.
    Here is the info on the failed software update from last night...
    Security Update for .NET Framework 3.5 SP1, Windows Vista SP2, and Windows Server 2008 SP2 x86 (KB2478660)
    Installation date: ‎6/‎16/‎2011 12:01 AM
    Installation status: Failed
    Error details: Code 80242006
    Update type: Important
    A security issue has been identified that could allow an attacker to compromise your Windows-based system that is running the Microsoft .NET Framework and gain complete control over it. You can help protect your computer by installing this update from Microsoft. After you install this item, you may have to restart your computer.
    More information:
    http://go.microsoft.com/fwlink/?LinkID=211422
    Help and Support:
    http://support.microsoft.com

    Hotmail is rolling out a server change at their end which might be causing this problem. Mozilla has spoken to them about it and they are trying to fix it. I won't be able to provide you a time estimate by when it will be solved but hotmail/mozilla is certainly looking at this issue.
    I will let you know if get any updates!

  • Using native sql for update

    Hello ,
    I have a reqaust to update a db table declared "outside" our R3 db.
    I mennage to select the data using native sql with a connection to the db.
    Now i need to modify the data on the db.
    Is there a similliar command like "fetch next" ' for update?
    Mybe i need to build a procedure in th "host" db and use its own commands to update?
    Thanks,
    koby

    Hello Kobi,
    Which release of SAP are you woking on?
    If you're on ECC6.0, instead you using Native SQL to call the stored procs of external DBs you can use the [ADBC APIs |http://help.sap.com/abapdocu_702/en/abenadbc_procedure.htm](CL_SQL* classes).
    BR,
    Suhas

  • Can anybody see what is wrong with this SQL statement?

    Hey guys, just a quick question. Can anybody tell me what is wrong with this line of SQL? I keep getting a syntax error message. I've been trying for ages and I can't see any problem at all!"
    {code}prepStat = connection.prepareStatement("INSERT INTO WeatherHistory (Date, Location, Overview, Temperature, WindDirection, WindSpeed, Pressure) VALUES ('"+date+"','"+location+"','"+temp+"','"+windDir+"','"+windSpd+"','"+pressure+"')");{code}
    All the field names and variables definitely exist so I can't see what the problem is!

    DHD wrote:
    Thanks for the replies.
    I've matched the correct number of column names and variables, but still no luck.
    And how exactly am I misusing Prepared Statements here?As noted above, not according to the code you posted. I didn't just pluck something out of my @ss and throw it out there. There was a reason behind what I said. And, if you mean you changed it, and you still got an exception, then post that exception (completely), and your new code, which is, hopefully, using PreparedStatement, (properly).

  • What's wrong with my code for comparing date retreived from db and sysdate?

    Hi all,
    I need to retrive date from the DB and compare it to system date.i have posted the code below.i get java.sql.SQL Exception:Io exception:Socket closed.
    What's wrong with the code?please help me.Thanks in advance.
    public boolean date() throws IOException, SQLException {
    Connection con1;
    long millis = System.currentTimeMillis();
    Timestamp timestamp = new java.sql.Timestamp(millis);
    ResultSet rs4 = null;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection(
    "jdbc:oracle:thin:@abc:1605:xyz",
    "cdf", "cdf");
    Statement stmt_exp = con.createStatement();
    rs4 = stmt_exp.executeQuery("SELECT DATE FROM TABLE_NAME")
    while (rs4.next()) {
    Timestamp timestamp2 = rs4.getTimestamp("expire_date");
    con1.close();
    catch (Exception e)
    e.printStackTrace();
    finally
    //ResultSet rs4 = null;
    //Timestamp timestamp2;
    Timestamp timestamp2 = rs4.getTimestamp("expire_date");
    if (timestamp2.compareTo(timestamp) < 0)  //sysdate < exp date
    return true;
    } else {
    return false;
    }

    Didn't you understand what BalusC said? You're closing the connection and then trying to use the ResultSet. The ResultSet will be closed when you close the connection so you can't use it anymore.
    You should close the connection last thing in your code, probably in a finally. And after you close your ResultSet and Statement.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • What is wrong with weather bug for droid x?

    my weather bug temp at the info bar is saying its 123 degrees same as my verizon temp what is wrong with weather bug? its 91 in tulsa!? is this a bug they intend to fix anyone else have crazy temps i am using the free weather bug app. thanks for your help!

    right now my weather thingy show 107, my verizon website, 103, another phx weather shows 107 and i can't find weather on verizon site on phone.
    yours is definitely confused.
    is the area code right for your area?
    check accu weather, it's in the phone market.

Maybe you are looking for

  • Sun Java Application Server - Domain and Node agent stop automatically

    Hi, We have installed Sun Java Application server 8.1 in a local zone on Solaris 10. The installation was successful. A default domain (domain1) was created. We have deployed a sample application too. The problem is that the domain and node-agent sto

  • Enhance standard function module in ECC 5.0 System

    Hi All, My requirement is to add the custome fields in the standard screen.there is no screen exit for this screen. The screen is calling by using the standard function module CALL_SCREEN_HU_DISPLAY Iam working on ECC 5.0 System, Is it possisble to e

  • Cwm2_olap_metadata_refresh.mr_refresh ORA-01722: invalid number

    Hi, M getting these error message after refresh (cwm2_olap_metadata_refresh.mr_refresh) call. ERROR:: Object Type: Object Owner: Object Name: Secondary Name: Tertiary Name: ORA-01722: invalid number ERROR: declare ERROR at line 1: ORA-01722: invalid

  • Including one more gl in submit

    Hi frnds... I am using the below submit in my program my issue is that i want to include another Gl into the same submit ie, either 302205 or 400020 satisfying should get executed now in the below code only one gl is added...is there any other way i

  • Original Master files lost

    I dont' know how, or when. I've been using Aperture for years. I keep all files in the library, and library is on my main built in drive. I do a SuperDuper clone, a Time Machine, and a Vault. So it's backed up well. But in this case a backup doesn't