Whats wrong with my UPDATE query?????????

Hi friends,
I used an update query in my project but it doesnt seems to be work fine.
And here is my query:
String SQL1="UPDATE tbl_rmadetails SET serial_no="+serial_no+" AND replaced_serial_no="+replaced_serial_no+" AND status="+status+"AND customer_id="+custo+"AND item_id="+ite+" WHERE customer_id="+custo+"AND item_id="+ite;
Did i mess up the query..
Is it?
If not then whats the problem.
I use PreparedStatement to execute the query.
Any help will be appreciated

So if i have 16 fields and i want to update only 5 fields means i gotta leave other fields like the below one..
String SQL2="UPDATE tbl_rmadetails SET serial_no="+serial_no+","+ "replaced_serial_no="+replaced_serial_no+","+ "status="+status+","+"customer_id="+custo+"," +"item_id="+ite+"WHERE customer_id="+custo+"AND item_id="+ite+" AND serial_no="+serial_no;
                         ps=con.prepareStatement(SQL2);
                         ps.setString(3,custo);
                         ps.setString(4,ite);
                         ps.setInt(8,serial_no);
                         ps.setInt(10,replaced_serial_no);
                         ps.setString(11,status);
                         x=ps.executeUpdate();It gives me an error like this one in my console...
java.sql.SQLException: Parameter index out of range (3 > 0).
        at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2
001)
        at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:110
3)
        at com.rajk.javacode.servlets.RMAEntryModel.updateOut(RMAEntryModel.java
:310)
        at com.rajk.javacode.servlets.RMAOutServlet.doPost(RMAOutServlet.java:31
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:175)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
        at java.lang.Thread.run(Unknown Source)I dont want to update other fields.. i leave them as it is.. i juz want to know whether i could update only necessary fields out of all?
ANyhelp would be appreciated

Similar Messages

  • Whats wrong with the sql query-- giving no rows selected

    i have a table audit_data with 4 columns , eff_m & end_m are declared as timestamp and the time stamp data is different for all the records
    Please advice as soon as possible as this is a production problem
    ORG_GRP_I grn_n ED_EFF_m (timestamp) ED_END_M OFV
    1 999 01-Jan-06 1 03-Aug-06 0 0
    1 999 28-Jul-06 0 04-Aug-06 1 0
    1 999 04-Aug-06 1 04-Aug-06 1 0
    1 999 04-Aug-06 0 6.08
    This query is giving no rows returned,even though there is data in database
    SELECT NVL(OFV,0)
    FROM audit_data ag
    WHERE ag.ORG_GRP_I = 1
    AND ag.GRN_N = 999
    AND (ag.ED_EFF_M,NVL(ag.ED_END_M,SYSDATE)) IN (SELECT MAX(ED_EFF_M),MAX(NVL(ED_END_M,SYSDATE))
    FROM audit_data ag2
    WHERE ag2.ORG_GRP_I= ag.org_grp_i
    AND ag2.grn_n=ag.grn_n
    AND To_Date(To_Char(ag2.ED_EFF_M,'MM/DD/YYYY'),'MM/DD/YYYY') <= TO_DATE(TO_CHAR('08/04/06','MM/DD/YYYY'),'MM/DD/YYYY')
    AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE(TO_CHAR('08/04/06','MM/DD/YYYY'),'MM/DD/YYYY'));
    This query is giving value 6.08, when made type conversions.
    what wrong with the above query.please advice
    SELECT NVL(OFV,0)
    FROM audit_data ag
    WHERE ag.ORG_GRP_I = 1
    AND ag.GRN_n = 999
    AND (to_date(to_char(ag.ED_EFF_M,'mm/dd/yyyy'),'mm/dd/yyyy'),NVL(to_date(to_char(ag.ED_END_M,'mm/dd/yyyy'),'mm/dd/yyyy'),SYSDATE)) IN
    (SELECT MAX(to_date(to_char(ED_EFF_M,'mm/dd/yyyy'),'mm/dd/yyyy')),MAX(NVL(ED_END_M,SYSDATE))
    FROM audit_data ag2
    WHERE ag2.ORG_GRP_I= ag.org_grp_i
    AND ag2.grn_n=ag.grn_n
    AND To_Date(To_Char(ag2.ED_EFF_M,'MM/DD/YYYY'),'MM/DD/YYYY') <= TO_date('08/04/2006','MM/DD/YYYY')
    AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE('08/04/2006','MM/DD/YYYY'));

    In the second query you convert a string to a date correctly using TO_DATE(string,date format)
    In the first query you try to make a char of something that already is a char, e.g. TO_CHAR('08/04/06','MM/DD/YYYY').
    The TO_CHAR functions expects either a number or a date as its first parameter. That's why it's giving you a ORA-01722.

  • Whats wrong with the given query?

    i have written a query to check for the dependency of indexed columns .
    but its not retuning any data.I have checked individually for columns and they are used.Then why i am not getting any data from the below given query.
    select type,NAME,LINE,TEXT from all_source where upper(text) like
    ('''%'||'SELECT column_name FROM all_ind_columns where table_name in
    (''WSF_PERSON'',
    ''WSF_CODESET_TYPECODE'',
    ''GTT_STUDENT_REC_UR'',
    ''UPLOAD_ROSTER_LOG'',
    ''WSF_CLASSOFFERING'',
    ''PHCORE_CLASS_WORKGROUP'',
    ''WSF_STUDENTENROLLMENTEVENT'',
    ''WSF_SCHOOLYEAR'',
    ''WSF_CLASSSTUDENT'',
    ''WSF_GRADELEVEL_MASTER'',
    ''NCS4S_ACCOUNT_INFO'',
    ''WSF_EDUCATION_ORGUNIT'',
    ''WSF_PERSONROLE'',
    ''WSF_STUDENT'')'||'%''')

    Hi,
    My guess is you're hitting a 'too_many_quotes '...
    Try this:
    with cols as ( select column_name
                   from   all_ind_columns
                   where  table_name in  ('WSF_PERSON',
                                          'WSF_CODESET_TYPECODE',
                                          'GTT_STUDENT_REC_UR',
                                          'UPLOAD_ROSTER_LOG',
                                          'WSF_CLASSOFFERING',
                                          'PHCORE_CLASS_WORKGROUP',
                                          'WSF_STUDENTENROLLMENTEVENT',
                                          'WSF_SCHOOLYEAR',
                                          'WSF_CLASSSTUDENT',
                                          'WSF_GRADELEVEL_MASTER',
                                          'NCS4S_ACCOUNT_INFO',
                                          'WSF_EDUCATION_ORGUNIT',
                                          'WSF_PERSONROLE',
                                          'WSF_STUDENT')
    select type
    ,      name
    ,      line
    ,      text
    from   all_source
    ,      cols
    where  upper(text) like '%'||column_name||'%';(You might also want to add a restriction on the OWNER and/or use select distinct...)

  • What wrong with the updates?

    ok so i try to update everything on my phone, nothing except for an error. i restore my phone, still cant update em and the app store says there are no updates available. help

    Zo, do you download when Software Update tells you or do you go to something like VersionTracker? Klaus is right that a 10.4.8 combo update ususally takes care of things. What has been happening is that you are trying to update apps that need to be updated incrementally, which is why the combo, which will install all the security and OS inmprovements at one time is a good idea.
    DBefore you run the combo, repair permissions, and make sure to disconnect all firwire peripherals, and run permissions repair after as well, iTunes changes a lot of them for most people.
    Do post back and let us know how you make out,
    Miriam

  • Whats wrong with the sql query insert .... plz tell me

    {
    String sql = "INSERT INTO candidate VALUES (";
    sql += candidate.getEnrollmentNumber() + ",";
    sql += candidate.getDateOfEnrollment() + ",";
    sql += candidate.getName() + ",";
    sql += candidate.getContactNumber() + ",";
    sql += candidate.getGender() + ",";
    sql += candidate.getMailingAddress() + ",";
    sql += candidate.getEmailId() +",";
    sql += candidate.getClassOfVehicle() + ",";
    sql += candidate.getTypeOfVehicle() + ",";
    sql += candidate.getDateOfBirth() + ",";
    sql += candidate.getBatchTime() +")";
    System.out.println("sql: " +sql);
    //executeQuery(sql);
    executeUpdate(sql);
    }catch(SQLException e){
    e.printStackTrace();
    Giving me error as " com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax;

    If you are inserting a string into your sql, you need to put it in single quotes (but not numbers).
    Example:
    sql += " ' "+candidate.getFirstName() " ', "
    Additionally, if firstName contains a single quote, it needs to be escaped by converting it to two single quotes.
    Note you don't have to do any of this if you use preparedStatements.
    Note: remove both spaces in " ' " so you get "'" in the above example, otherwise you are inserting spaces into your value.
    I use " ' " so you can more easily see what I did..

  • What is the wrong with my select query

    HI All,
    TYPES: BEGIN OF t_equi,
             equnr          TYPE equi-equnr,
             aedat          TYPE equi-aedat,
             matnr          TYPE equi-matnr,
             sernr          TYPE equi-sernr,
             kunde          TYPE equi-kunde,
             zzreg_date     TYPE equi-zzreg_date,
             zzin_indic     TYPE equi-zzin_indic,
             zzinvoice_num  TYPE equi-zzinvoice_num,
             zzinvoice_date TYPE equi-zzinvoice_date,
             kund1          TYPE equz-kund1,
          END OF t_equi,
    DATA: it_equi        TYPE TABLE OF t_equi,
      SELECT equnr
             aedat
             matnr
             sernr
             kunde          "Ship to
             zzreg_date
             zzin_indic
             zzinvoice_num
             zzinvoice_date
             kund1            "Sold to
             INTO TABLE it_equi
             FROM equi AS a
             INNER JOIN equz AS b
             ON a~equnr = b~equnr
             WHERE a~equnr      IN s_equnr AND
    *               aedat GE gv_rdate AND
                   a~matnr      IN s_matnr AND
                   a~sernr      IN s_sernr AND
                   a~kunde      IN r_shpbr_kunde AND
                   a~zzin_indic IN s_indic  AND
                   b~datbi      EQ c_datbi  AND 
                   b~kund1     IN r_sldbr_kund1 .
    what is the wrong with this select query.. ?
    its giving me error  "The column name "EQUNR" is unclear ."
    Thanks

    Hi ,
    write  tablename or alias in select also
    SELECT a~equnr and check.
    Regards

  • HT201210 I have the Iphone 3gs and it said update required and i needed to connect to itunes so i did al that and now everytime i go to restore everything it just says error and then i have to do it again?whats wrong with it?

    I have the Iphone 3gs and it said update required and i needed to connect to itunes so i did al that and now everytime i go to restore everything it just says error and then i have to do it again?whats wrong with it?

    Are you getting an error message number with your error message? If so, what number are you getting?

  • After updating 4.3.1 to 4.3.3 my i phone 4's wifi is not working 2 to 3 hrs of it ,but 3 hrs i was downloding free soft 4m itunes.............so what wrong with my phone

    after updating 4.3.1 to 4.3.3 my i phone 4's wifi is not working 2 to 3 hrs of it ,but 3 hrs i was downloding free soft 4m itunes.............so what wrong with my phone

    Thanks for reply,
    It's truely a disestar for me to kill my phone myself by so called bloody upgradation.
    Iwish I have not upgraded.
    I baught it from here in Bangladesh and now I’m ina mess to get at least a minimum support.
    Thanks for your valued suggessions but it didn’tmade any difference to my situation.
    So now I have an ipod in the price of an iPhone4. Crap.
    Is there any chance of fixing this bug by apple?As the same problem has already been faced by a lot of iPhone Users.

  • Whats wrong with the servers i cant download update 5.1 firmware

    whats wrong with the servers i cant download update 5.1 firmware ive been trying for 2 days it says i dont have permission to access the requested source

    What says you don't have permission to access the requested source? That is not an error that should come up at all either from iTunes or when attempting an over the air upgrade. At least not an error that has anything to do with the servers.
    It could be a permissions problem on your computer or an issue being caused by your firewall or antivirus software.

  • Whats wrong with this query.can anyone help me......

    select CASE WHEN TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0 AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
    THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)||'00',SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),'DD-MM-YYYY HH24:MI:SS') end
    from table;
    i have written this query.whats wrong with this query..........
    the error is "literal does not match format string"
    Reegards soumen

    Why does your date_format loose, ununify and not fix ?
    And what is your exact requirement?
    >>
    CASE WHEN
    TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0
    AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
    <<
    This is
    CASE WHEN TO_CHAR(START_TIME_TIMESTAMP,'MM') between '01' and '13'
    >>
    THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)
    ||'00',
    SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),
    'DD-MM-YYYY HH24:MI:SS')
    <<
    This is
    TO_DATE(
    TO_CHAR(START_TIME_TIMESTAMP,'MM"00"SS"00"),
    'DD-MM-YYYY HH24:MI:SS')
    Obviously, format is not matching !
    SQL> select to_char(sysdate,'MM"00"SS"00') from dual;
    TO_CHAR(
    06004900
    SQL> select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual;
    select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual
    ERROR at line 1:
    ORA-01861: literal does not match format string

  • What is wrong with software update???

    Software update say there's a conection issue, but wifi and internet is fine. What is wrong with software update???
    So I can't upgrade from osx 10.6.6 to anything... no mavericks for me?????

    Drimeister wrote:
    Software update say there's a conection issue, but wifi and internet is fine. What is wrong with software update???
    So I can't upgrade from osx 10.6.6 to anything... no mavericks for me?????
    Prior to upgrading to Mavericks, you must make sure you meet ALL of its system requirements. 

  • Whats wrong with code??

    hello guys...i am having some problems..the application runs fine until it reaches this bit of code..
    if(mode=="w"){
              System.out.println(" mode is weekly");
                   try{
                             ps4 =con.prepareStatement("UPDATE property SET tid=?,start=curdate(),days_due=adddate(start, 7) WHERE pid=?");
                                                 ps4.setInt(1, tid);
                                                 ps4.setInt(2, pid);
                                            ps4.executeUpdate();
                                            catch(SQLException e1){
                                                 e1.printStackTrace();
                   else if(mode=="m"){
                        System.out.println(" mode is monthly");
                        try{
                        ps4 =con.prepareStatement("UPDATE property SET tid=?,start=curdate(),days_due=adddate(start, 31) WHERE pid=?");
                                                                     ps4.setInt(1, tid);
                                                                     ps4.setInt(2, pid);
                                            ps4.executeUpdate();
                                       System.out.println(" property update query executed");
                        catch(SQLException e2){
                                                                System.out.println("property update Query not executed");
                                                                e2.printStackTrace();
    whats wrong with it?

    this part
    if(mode=="w"){should be:
    if(mode.equals("w")){and this part:
    else if(mode=="m"){should be:
    else if(mode.equals("m")){

  • I just got a ipod nano 6th gen, and ive been using it for 2 days, and it seems that the battery just lasts about half a day, on playing 1 to 3 songs in intervals of 1-2 hours. Whats wrong with my ipod?

    I just got a ipod nano 6th gen, and ive been using it for 2 days, and it seems that the battery just lasts about half a day, on playing 1 to 3 songs in intervals of 1-2 hours. Whats wrong with my ipod?

    Your nano would really have nothing to do with it at that point. It is really something between iTunes and whatever server out there on the internet that it is trying to connect to for the update.
    Try posting this one in the iTunes forum, they might have a solution for you.
    i

  • Help with a update query from a subquery

    Hello All,
    I wanted to see if someone can help me with an update query.
    I need to grab a latitude & longitude from a the same user that is in two accounts. therefore i am trying to update lat/long in a users table for one account based off of the same user in another account. I am matching the users up by phone number and last name. I tried a subquery but am having difficulty.
    I was thinking of something like the following:
    update users
    set lat = getlat, long = getlong
    inner join (select lat as getlat, long as get long from users where account_id = '1')
    on phone = phone and last name = lastname
    where account_id = '2' and lat IS NULL and long IS NULL
    Am I going in the right direction???
    Thanks in advance for any assistance!!!!

    What difficulty are you having? Have you tried what you posted and get an error?
    Although someone may be able to give you sql advice here, I would try posting this over at Stack Overflow as its not really related to Coldfusion.

  • What wrong with this?

    I have a video that has sound, I brought it into afteraffects, made a composition and made some changes. I exported the composition (rendered it) for quick time to edit in photoshop - the video is about 7 minutes.
    Playing the video there is no sound....why?
    Bringing the video into photoshop for editing with content aware fill creates 500+ frames......is that normal?
    also whats the easiest way to move between aftereffects and photoshop in terms of editing frames? can I make changes in photoshop and watch it update in after effects?

    What wrong with this?
    Everything! Sorry, it's simply the most ill-conceived workflow I could imagine.
    Playing the video there is no sound....why?
    http://forums.adobe.com/thread/426347?tstart=0
    Bringing the video into photoshop for editing with content aware fill creates 500+ frames......is that normal?
    Yes. All video editing in PS is limited to 500 or 1000 frames, repsectively. There is no way to extend that range. Read the PS help!
    also whats the easiest way to move between aftereffects and photoshop in terms of editing frames?
    You don't. What you have in mind won't work, anyways. Content Aware Fill only works per frame and has no temporal stabilization, so each frame will have a different pattern and the resulting animation would flicker and wobble.
    can I make changes in photoshop and watch it update in after effects?
    That's what use File --> Reload Footage for or simply close and reopen the project.
    Mylenium

Maybe you are looking for