JDBC: Syntax error in UPDATE statement???

Hi,
I have been trying to solve this seemingly simple problem for the past 4 hours, and I had no success. I am working on a jdbc:odbc connection which utilizes MS Access. I have been constantly getting "Syntax error in UPDATE statement", and this is the statement
(name of the table is CDs, columns are number, artist, album, label and date - all strings):
query = "UPDATE CDs SET artist = '" + fields.artist.getText() +"', album = '" +
fields.album.getText() + "', label = '" +
fields.label.getText() + "', date = '" +
fields.date.getText() + "' WHERE number = '" + fields.number.getText() + "'";
Can anybody recognize an error? Thank you,
mirkokrug

A couple of possibilities.
If the column NUMBER is numeric then it wouldn't need quotes around the data value. Also if the column DATE is a date or date/time type then the format from the textbox may not be correct.
Col

Similar Messages

  • [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

    Hi,
    I am getting following error message ,
    [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
    When run this code.
    <%@ page import= "java.sql.*"%>
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
    Statement st = con.createStatement();
    st.executeUpdate("update tscipshift set 11-Aug-08='M' where TechN='Elamparuthi'");
    %>
    tscipshift=table ,column=11-Aug-08 are all exist.
    I dont know why I am getting error mesage.
    Any idea why?

    Shahbaz2008 wrote:
    you haven't set your user name and password hereI don't believe that's necessary with Access. Then again, it's not an enterprise database.
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
    change it to this
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","+username+","+password+");
    here pass your username and password...
    In Oracle default user name and password is
    username = scott
    password = tigerSo who uses that? Only an eejit would leave that account open.
    So the statement would be
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","scott","tiger");
    or In Mirosoft Access there is no user name and password so the statement will be Like I said - unnecessary, and not the reason the OP is having problems.
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb","","");>
    Besides this change your table name 11-Aug-08 to anything that is not start with number or any special symbols.
    for example aug112008 is good or aug is too good.No, it's still not good if you understand ANYTHING about relational databases and normalization.
    I think it would work.I think you're just as stup!d as the OP.
    %

  • Syntax Error in Update Statement

    Would a smart and kind CF pro mind putting a fresh pair of
    eyes on this code and tell me where the syntax error is? All the
    fields in the statement are numeric except the last one (comments).
    I have enclosed them in val() to ensure they are numeric when
    inserted into the DB. The fields they're being inserted into are
    numeric. I need to be numeric because I will be doing calculations
    on them. Also, I have triple-checked to ensure the datasource,
    table, and field names all match.
    Thanks,
    GwenH

    Try using <cfqueryparam>
    <cfquery datasource="reviews">
    UPDATE evals
    SET focus = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.focus#">
    , strengths = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.strengths#">
    , tailored = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.tailored#">
    , badinfo = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.badinfo#">
    , format = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.format#">
    , visual = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.visual#">
    , grammar = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.grammar#">
    , pronouns = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.pronouns#">
    , written = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.written#">
    , achieve = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.achieve#">
    , sell = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.sell#">
    , negative = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.negative#">
    , top = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.top#">
    , general = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.general#">
    , intro = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.intro#">
    , orientation = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.orientation#">
    , paragraphs = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.paragraphs#">
    , two = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.two#">
    , length = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.length#">
    , none = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.none#">
    , comments = <cfqueryparam cfsqltype="cf_sql_clob"
    value="#form.comments#">
    WHERE resumeID = <cfqueryparam cfsqltype="cf_sql_numeric"
    value="#form.resumeID#">
    </cfquery>
    Ken Ford
    Adobe Community Expert Dreamweaver/ColdFusion
    Adobe Certified Expert - Dreamweaver CS3
    Adobe Certified Expert - ColdFusion 8
    Fordwebs, LLC
    http://www.fordwebs.com
    "GwenH" <[email protected]> wrote in message
    news:[email protected]...
    > Would a smart and kind CF pro mind putting a fresh pair
    of eyes on this
    > code
    > and tell me where the syntax error is? All the fields in
    the statement are
    > numeric except the last one (comments). I have enclosed
    them in val() to
    > ensure
    > they are numeric when inserted into the DB. The fields
    they're being
    > inserted
    > into are numeric. I need to be numeric because I will be
    doing
    > calculations on
    > them. Also, I have triple-checked to ensure the
    datasource, table, and
    > field
    > names all match.
    >
    > Thanks,
    > GwenH
    >
    > <cfquery datasource="reviews">
    > UPDATE evals
    > SET
    > focus = val(#form.focus#)
    > , strengths = val(#form.strengths#)
    > , tailored = val(#form.tailored#)
    > , badinfo = val(#form.badinfo#)
    > , format = val(#form.format#)
    > , visual = val(#form.visual#)
    > , grammar = val(#form.grammar#)
    > , pronouns = val(#form.pronouns#)
    > , written = val(#form.written#)
    > , achieve = val(#form.achieve#)
    > , sell = val(#form.sell#)
    > , negative = val(#form.negative#)
    > , top = val(#form.top#)
    > , general = val(#form.general#)
    > , intro = val(#form.intro#)
    > , orientation = val(#form.orientation#)
    > , paragraphs = val(#form.paragraphs#)
    > , two = val(#form.two#)
    > , length = val(#form.length#)
    > , none = val(#form.none#)
    > , comments = '#form.comments#'
    > WHERE resumeID = #form.resumeID#
    > </cfquery>
    >

  • 'Missing select' error for update statement using WITH clause

    Hi,
    I am getting the below error for update statement using WITH clause
    SQL Error: ORA-00928: missing SELECT keyword
      UPDATE A
      set A.col1 = 'val1'
         where
      A.col2 IN (
      WITH D AS
      SELECT col2 FROM
      (SELECT col2, MIN(datecol) col3 FROM DS
      WHERE <conditions>
        GROUP BY PATIENT) D2
      WHERE
      <conditions on A.col4 and D2.col3>

    Hi,
    The format of a query using WITH is:
    WITH  d  AS
        SELECT  ...  -- sub_query
    SELECT  ...   -- main query
    You don't have a main query.  The keyword FROM has to come immediately after the right ')' that ends the last WITH clause sub-query.
    That explains the problem based on what you posted.  I can't tell if the real problem is in the conditions that you didn't post.
    I hope this answers your question.
    If not, post a complete test script that people can run to re-create the problem and test their ideas.  Include a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Error in update statement

    Hai All
    update dail set timeout=out_time where attend_date=r1.bardate and
    (select bar_code from empl_barcode where empl_barcode.barcode=r1.barcode);
    I got an error in my update statement. How can i write update statement with this or where i change..
    Regards
    Srikkanth.M

    Hi,
    review the syntax for the UNDATE statement. The following is okay:
    UPDATE     dail
    SET     timeout          = out_time
    WHERE     attend_date     = x
    AND     y          > z
    ;if all the columns (including x, y and z) are in dail.
    If you need to get some of those values from another table, then you can do a scalar sub-query , that is, a query that returns 9at most) one row, enclosed in parentheses.
    For example, if x is in another table (named r1), you might say:
    UPDATE     dail     m
    SET     timeout          = out_time
    WHERE     attend_date     = (     -- Begin scalar sub-query
                        SELECT     MAX (bardate)
                        FROM     r1
                        WHERE     dail_id     = m.id
                     )     -- End scalar sub-query
    AND     y          > z
    ;It looks like you're trying to do something similar.
    I'm not sure exactly what x is supposed to be, and you're missing y (or z) as well as the operator between them.
    MERGE is often easier to use than UPDATE, when you need to reference other tables.
    If you'd like help, post a little sample data (CREATE TABLE and INSERT statements for all tables as they exist before the UPDATE) and the results you want from taht data (the contents of dail after the UPDATE).

  • Sender JDBC: help to construct Update statement

    Hi,
    I need help in writing a update statement to DB2 database in sender JDBC adapter.
    The sender adapter picks up only few records say 10 at a time which match the Select query condition. So I would need to update only those selected "n" records and not all the records that match the Select query condition.
    Select looks like :
    Select * from <table> where <condition> fetch first <n> rows only.
    But it is not allowing the following update
    update <table> set <field> = <value> where <field> IN (Select * from <table> where <condition> fetch first <n> rows only)
    The above statement errors because DB2 does not allows u201CFetchu201D statement within the update sub query.
    Any pointers to a write update statement for n records is highly appreciatedu2026
    ~SaNvu2026

    Hi Santosh,
    In JDBC Sender Adapter provide the following select & update statements
    Select Statement:
    select * from <table> where <condition> AND ROWNUM<N (N==No.of Rows)
    Update Statement:
    update <table> set <field> = <value> where <field> IN (Select * from <table> where <condition> AND ROWNUM<N)
    (N==No.of Rows)
    And for the error you are facing is because of the server communication link failure between the two systems.
    Check the connections and try to stop & start communication channels once.
    Regards
    Venkat Rao .G

  • Syntax error in INSERT STATEMENT

    A problem on the date part of the query but why I don´t
    know, Thanks for any pointers,
    TIA
    <cfquery name="update1" datasource="trevor_SecurityDB">
    INSERT INTO imagesproducts
    (title, info, date)
    VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
    </cfquery>
    Error Occurred While Processing Request
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
    INSERT INTO statement.
    The error occurred in uploadmember.cfm: line 28
    26 : INSERT INTO imagesproducts
    27 : (title, info, date)
    28 : VALUES ( '#form.title#', '#form.info#',
    '#DateFormat(Now())#' )
    29 : </cfquery>
    30 :
    SQL INSERT INTO imagesproducts (title, info, date) VALUES (
    'News test', 'Testing news info', '12-Jul-07' )
    DATASOURCE trevor_SecurityDB
    VENDORERRORCODE -3502
    SQLSTATE 42000

    Perhaps it is a reserved word issue with the date column,
    since
    date is an ODBC Reserved Keyword. You might try enclosing it
    within brackets [ ].
    <cfquery name="update1" datasource="trevor_SecurityDB">
    INSERT INTO imagesproducts
    (title, info, [date])
    VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
    </cfquery>
    Or, if that doesn't help, you might try using a cfqueryparam
    tag for the '#DateFormat(Now())#' value using a cfsqltype =
    "CF_SQL_TIMESTAMP" (assuming a date/time datatype on the column).
    Also, you might look into using one of the CreateODBCDateTime() or
    CreateODBCDate() functions.
    Phil

  • Help!  Syntax Error in SQL statement

    Hello. I'm getting an error message and I'm just not seeing
    where I went wrong. The SQL statement is:
    updateSQL = "UPDATE TrainingHistory SET Status='" &
    fFormat(Request.Form(cStatus)) & "', StatusComments='" &
    fFormat(Request.Form(cStatusComments)) & " WHERE Training_ID="
    & fFormat(Request.Form(cTrainingID))
    The error message is:
    [Microsoft][ODBC Microsoft Access Driver] Syntax error in
    string in query expression '' WHERE Training_ID=9054'.
    I've been looking at it for a while. Not sure where I went
    wrong. Here is a more complete version of the code:
    <%
    Function fFormat(vText)
    fFormat = Replace(vText, "'", "''")
    End Function
    Sub sRunSQL(vSQL)
    set cExecute = Server.CreateObject("ADODB.Command")
    With cExecute
    .ActiveConnection = MM_coldsuncrea_lms_STRING
    .CommandText = vSQL
    .CommandType = 1
    .CommandTimeout = 0
    .Prepared = true
    .Execute()
    End With
    End Sub
    If Request.Form("action")="update" Then
    'Set variables for update
    Dim updateSQL, i
    Dim cTrainingID, cStatus, cStatusComments
    'Loop through records on screen and update
    For i = 1 To fFormat(Request.Form("counter"))
    'Create the proper field names to reference on the form
    cTrainingID = "Training_ID" & CStr(i)
    cStatus = "Status" & CStr(i)
    cStatusComments = "StatusComments" & CStr(i)
    'Create the update sql statement
    updateSQL = "UPDATE TrainingHistory SET Status='" &
    fFormat(Request.Form(cStatus)) & "', StatusComments='" &
    fFormat(Request.Form(cStatusComments)) & " WHERE Training_ID="
    & fFormat(Request.Form(cTrainingID))
    'Run the sql statement
    Call sRunSQL(updateSQL)
    Next
    'Refresh page
    Response.Redirect("ClassUpdateRoster.asp?Training_ID=") &
    (rsClassDetails.Fields.Item("event_ID").Value)
    End If
    %>

    You need another single quote after the double quote before
    the WHERE clause. You are not closing the single quote you used to
    delimit the value for StatusComments.

  • Syntax error in Update Routine

    Dear All,
    While trying to update infoobject /BIC/ZGROSSPRI in an ODS in BI through an update routine, a syntax error is thrown when I am defining a variable of type  tys_TG_1-/BIC/ZGROSSPRI.
    For instance,
    DATA: VALUE TYPE tys_TG_1-/BIC/ZGROSSPRI.
    The error is :
    E:Field "_ty_s_TG_1-/BIC/ZGROSSPRI" is unknown. It is neither in one of the
    specified tables nor defined by a "DATA" statement. "DATA" statement.
    Below given is the code which I am using for the same. Kindly advise how to correct this error.
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    Edited by: Suneeth Sebastian on Apr 7, 2010 4:11 PM
    Edited by: Rob Burbank on Apr 7, 2010 1:19 PM

    Dear All,
    While trying to update infoobject /BIC/ZGROSSPRI in an ODS in BI through an update routine, a syntax error is thrown when I am trying to define a variable of type tys_TG_1-/BIC/ZGROSSPRI. How is it possible to define a variable of type target field(Infoobject) ?
    For instance,
    DATA: VALUE TYPE tys_TG_1-/BIC/ZGROSSPRI.
    The error is :
    E:Field "_ty_s_TG_1-/BIC/ZGROSSPRI" is unknown. It is neither in one of the
    specified tables nor defined by a "DATA" statement. "DATA" statement.
    tys_TG_1-/BIC/ZGROSSPRI is already defined in the Class section as below
    TYPES:
          BEGIN OF tys_TG_1,
         InfoObject: ZGROSSPRI Gross Price in Statistical Currency.
            /BIC/ZGROSSPRI           TYPE /BIC/OIZGROSSPRI,
          END   OF tys_TG_1.

  • Syntax Error with EXPORT statement in ECC 6

    Hi All,
    I have one issue with EXPORT statement syntax.
    I have declared data like below:
    DATA: BEGIN OF mem_id,
              mandt LIKE sy-mandt,
              uname LIKE sy-uname,
              modno LIKE sy-modno,
            END OF mem_id.
    export the memory id
        EXPORT E_VBKOK XANZPK TEXTTAB XBOLNR TO MEMORY ID MEM_ID.
    When I am checking the syntax error i am getting like "MEM_ID" must be a character-type field (data type C, N, D or T). by "INTERFACE". by "INTERFACE". "INTERFACE". by "INTERFACE". by "INTERFACE".
    I know this statement would be like IMPORT ITAB TO JTAB FROM MEMORY ID 'table'. So I have written like below
    EXPORT E_VBKOK XANZPK TEXTTAB XBOLNR TO MEMORY ID 'MEM_ID'. But still it is throwing an error.
    Can you please let me know how can I resolve this?
    Regards,
    Jyothi CH.

    Hi Jyothi,
    data: l_var type string.
    concatenate '6' '8' into l_var separated by space.
    export l_var to memory id 'BB'.
    Here we have to declare the type(structure) for l_var not for BB
    and in another program
    data:l_var type string.
    import l_var from memory id 'BB'.
    write : l_var.

  • LOG ERRORS failing to capture 2291 errors on UPDATE statement

    We are running Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
    We have often successfully used the error logging clause when performing batch inserts to the database. However, we now have a situation where an UPDATE statement is failing and rolling back upon encountering a foreign-key referential constraint [ORA-02291]. It is successfully recording Check constraint errors [ORA-02290]. The foreign keys are not deferred, and they have nothing to do with any unique constraints or indices on the table that is the target of the UPDATE statement. The Error-logging table was created by using the DBMS_ERRLOG package. We recreated it to make sure that we had not introduced column format errors. The same problem occurs. The UPDATE statement is attempting to update approximately 12000 rows. Any help in understanding this problem would be appreciated.
    Here is the error statement
    ORA-02291: integrity constraint (OIFS.FRAME_FK07) violated - parent key not found
    Here is the problem statement and its surrounding PLSQL block:
    BEGIN <<update_records>>
    UPDATE frame f
    SET (company_name,
    address1_line,
    address2_line,
    address1_city,
    address1_state,
    address1_zip,
    contact1_name,
    contact1_phone_number,
    update_date,
    update_user,
    -- comments,
    facility_name,
    facility_type,
    doing_business_as,
    contact1_phone_ext,
    contact1_fax,
    contact1_email,
    contact2_name,
    contact2_phone_number,
    contact2_phone_ext,
    contact2_fax,
    contact2_email,
    source_survey,
    source_status,
    address2_city,
    address2_state,
    address2_zip,
    facility_location_number,
    attention_line,
    company_official,
    facility_irs_code
    ) =
    (SELECT company_name,
    address1_line,
    address2_line,
    address1_city,
    address1_state,
    address1_zip,
    contact1_name,
    contact1_phone_number,
    SYSDATE,
    user_in,
    facility_name,
    facility_type,
    doing_business_as,
    contact1_phone_ext,
    contact1_fax,
    contact1_email,
    contact2_name,
    contact2_phone_number,
    contact2_phone_ext,
    contact2_fax,
    contact2_email,
    source_survey,
    source_status,
    address2_city,
    address2_state,
    address2_zip,
    facility_location_number,
    attention_line,
    company_official,
    facility_irs_code
    FROM oifs.respondent r
    WHERE r.cin = f.cin
    WHERE f.cin IN
    (SELECT cin
    FROM
    (SELECT cin,
    company_name,
    address1_line,
    address2_line,
    address1_city,
    address1_state,
    address1_zip,
    contact1_name,
    contact1_phone_number,
    facility_name,
    facility_type,
    doing_business_as,
    contact1_phone_ext,
    contact1_fax,
    contact1_email,
    contact2_name,
    contact2_phone_number,
    contact2_phone_ext,
    contact2_fax,
    contact2_email,
    source_survey,
    source_status,
    address2_city,
    address2_state,
    address2_zip,
    facility_location_number,
    attention_line,
    company_official,
    facility_irs_code
    FROM oifs.respondent
    MINUS
    SELECT cin,
    company_name,
    address1_line,
    address2_line,
    address1_city,
    address1_state,
    address1_zip,
    contact1_name,
    contact1_phone_number,
    facility_name,
    facility_type,
    doing_business_as,
    contact1_phone_ext,
    contact1_fax,
    contact1_email,
    contact2_name,
    contact2_phone_number,
    contact2_phone_ext,
    contact2_fax,
    contact2_email,
    source_survey,
    source_status,
    address2_city,
    address2_state,
    address2_zip,
    facility_location_number,
    attention_line,
    company_official,
    facility_irs_code
    FROM oifs.frame
    LOG ERRORS INTO oifs.frame_load_errors
    (job_num || ' ' || TO_CHAR(SYSDATE, 'YYYYMMDD HH24:MI:SS') || ' update')
    REJECT LIMIT UNLIMITED;
    EXCEPTION
    WHEN OTHERS THEN
    ohub.err_pkg.record_and_continue(msg_in => 'problem in updating FRAME rows');
    RAISE;
    END update_records;

    Thank you for your help. It pointed me in the right direction, which was to temporarily disable the triggers. The ORA-02291 errors were then properly captured in the error-logging-table.
    The problem did not appear to be related to the trigger. The problem that was captured in my PLSQL error-handler but not the error-logging-table was an ORA-02291, which was specific to the original table. The trigger-driven processing did not seem to generate any errors (I have PLSQL error-handling logic in there as well).
    I was aware of Tom Kyte's statement, and I knew triggers were dicey when I decided to use them. It seemed the best way to try to ensure database integrity when regular Foreign-Key and Check constraints did not suffice. I am now paying the price for that decision.

  • Syntax error in modify statement

    Hi Friends,
    There is an Internal table IT_STATUS which is the Parameter in BADI Method IF_EX_WORKORDER_UPDATE~BEFORE_UPDATE.
    Below is the code i have written
    Data:  wa_status type cobai_s_status,
                       stat TYPE TABLE OF jstat,
                       wa_stat type jstat.
          CALL FUNCTION 'STATUS_READ'
            EXPORTING
             client                 = sy-mandt
              objnr                  = gv_objnr
    *     ONLY_ACTIVE            = ' '
    *   IMPORTING
    *     OBTYP                  =
    *     STSMA                  =
    *     STONR                  =
           TABLES
             status                 = stat
           EXCEPTIONS
             object_not_found       = 1
             OTHERS                 = 2
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ELSE.
           loop at it_status into wa_status.
            read table stat into wa_stat with key STAT = wa_status-stat.
            if sy-subrc = 0.
             wa_status-stat = wa_stat-stat.
             wa_status-INACT = wa_stat-INACT.
             modify it_status from wa_status transporting stat inact.
            endif.
           endloop.
          ENDIF.
    At Modify statement it is giving a syntax error 'The <b>field "IT_STATUS" cannot be changed.-</b>'. what could be the reason?
    Please provide me the solution.
    Thanks & Regards,
    Satish

    Hi Rob,
    This is the whole code which i had written in method
    METHOD if_ex_workorder_update~before_update.
      DATA: gv_aufnr TYPE afih-aufnr,
            gv_objnr TYPE jest-objnr,
            stat TYPE TABLE OF jstat,
            wa_stat TYPE jstat,
            wa_header TYPE cobai_s_header,
            wa_status TYPE cobai_s_status,
            it_status_new TYPE cobai_t_status.
      DATA: status_index TYPE sy-tabix.
      BREAK-POINT.
      LOOP AT it_header INTO wa_header.
        SELECT SINGLE aufnr FROM afih INTO gv_aufnr WHERE warpl = wa_header-warpl AND abnum = 1.
        IF sy-subrc = 0.
          CONCATENATE 'OR' gv_aufnr INTO gv_objnr.
          CALL FUNCTION 'STATUS_READ'
            EXPORTING
             client                 = sy-mandt
              objnr                  = gv_objnr
    *     ONLY_ACTIVE            = ' '
    *   IMPORTING
    *     OBTYP                  =
    *     STSMA                  =
    *     STONR                  =
           TABLES
             status                 = stat
           EXCEPTIONS
             object_not_found       = 1
             OTHERS                 = 2
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ELSE.
            LOOP AT it_status INTO wa_status.
              status_index = sy-tabix.
              READ TABLE stat INTO wa_stat WITH KEY stat = wa_status-stat.
              IF sy-subrc = 0.
                wa_status-stat = wa_stat-stat.
                wa_status-inact = wa_stat-inact.
                MODIFY it_status INDEX status_index FROM wa_status TRANSPORTING stat inact.
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDMETHOD.
    Hope it will get resolved
    Regards,
    Satish

  • Syntax error using try statement in WLST

    Hi All,
    I have a WLST script to create some JMS resources.
    I want to implement exception handling in such a way that if the script fails at any point, all the changes done should be reverted back.
    However, whenever I am trying to put a try block, the script is throwing syntax error on the first line after the try statement.
    Please find below the script I am using. Please suggest
    import sys
    from java.lang import System
    *# Putting a try statement here results in a syntax error at the below line*
    print "Starting the script ..."
    connect('weblogic',password,'t3://osbdev:7001')
    edit()
    startEdit()
    servermb=getMBean("Servers/osb_server")
    if servermb is None:
    print 'Value is Null'
    else:
    +# Creating the JMS Server+
    jmsserver1mb = create('WLSTJMSServer','JMSServer')
    jmsserver1mb.addTarget(servermb)
    +# Creating the JMS Module+
    jmsMySystemResource = create("WLSTJmsSystemResource","JMSSystemResource")
    jmsMySystemResource.addTarget(servermb)
    subDep1mb = jmsMySystemResource .createSubDeployment('WLSTJMSSubDeployment')
    subDep1mb.addTarget(jmsserver1mb)
    theJMSResource = jmsMySystemResource.getJMSResource()
    connfact1 = theJMSResource.createConnectionFactory('WLSTConnFact1')
    connfact1.setJNDIName('jms.WLSTConnFact1')
    connfact1.setSubDeploymentName('WLSTJMSSubDeployment')
    print "Creating WLSTQueue1..."
    jmsqueue1 = theJMSResource.createQueue('WLSTJMSQueue1')
    jmsqueue1.setJNDIName('jms.WLSTJMSQueue1')
    jmsqueue1.setSubDeploymentName('WLSTJMSSubDeployment')
    print "Creating WLSTQueue2..."
    jmsqueue2 = theJMSResource.createQueue('WLSTJMSQueue2')
    jmsqueue2.setJNDIName('jms.WLSTJMSQueue2')
    jmsqueue2.setSubDeploymentName('WLSTJMSSubDeployment')
    *# try statement is working at only this point of the program*
    try:
    save()
    activate(block="true")
    print "script returns SUCCESS"
    except:
    save()
    cancelEdit(defaultAnswer="y")
    print "Error while trying to connect to server !!!"
    print "Unexpected error: ", sys.exc_info()[0]
    dumpStack()
    raise
    Edited by: Chintan Parekh on Mar 16, 2011 7:06 AM

    Hi Chintan,
    Try doing copy pasting the below code, you have to hit the tab or space after try or except to create its block and keep an eye on the alinement's of it.
    try:
         save()
         activate(block="true")
         print "script returns SUCCESS"
    except:
         save()
         cancelEdit(defaultAnswer="y")
         print "Error while trying to connect to server !!!"
         print "Unexpected error: ", sys.exc_info()[0]
         dumpStack()Also I made the alinement's properly and the script is running properly with out any error.
    print "Starting the script ..."
    connect('weblogic','weblogic','t3://localhost:7001')
    edit()
    startEdit()
    servermb=getMBean("Servers/AdminServer")
    if servermb is None:
         print 'Value is Null'
    else:
         # Creating the JMS Server
         jmsserver1mb = create('WLSTJMSServer','JMSServer')
         jmsserver1mb.addTarget(servermb)
         # Creating the JMS Module
         jmsMySystemResource = create("WLSTJmsSystemResource","JMSSystemResource")
         jmsMySystemResource.addTarget(servermb)
         subDep1mb = jmsMySystemResource .createSubDeployment('WLSTJMSSubDeployment')
         subDep1mb.addTarget(jmsserver1mb)
         theJMSResource = jmsMySystemResource.getJMSResource()
         connfact1 = theJMSResource.createConnectionFactory('WLSTConnFact1')
         connfact1.setJNDIName('jms.WLSTConnFact1')
         connfact1.setSubDeploymentName('WLSTJMSSubDeployment')
         print "Creating WLSTQueue1..."
         jmsqueue1 = theJMSResource.createQueue('WLSTJMSQueue1')
         jmsqueue1.setJNDIName('jms.WLSTJMSQueue1')
         jmsqueue1.setSubDeploymentName('WLSTJMSSubDeployment')
         print "Creating WLSTQueue2..."
         jmsqueue2 = theJMSResource.createQueue('WLSTJMSQueue2')
         jmsqueue2.setJNDIName('jms.WLSTJMSQueue2')
         jmsqueue2.setSubDeploymentName('WLSTJMSSubDeployment')
    # try statement is working at only this point of the program
    try:
         save()
         activate(block="true")
         print "script returns SUCCESS"
    except:
         save()
         cancelEdit(defaultAnswer="y")
         print "Error while trying to connect to server !!!"
         print "Unexpected error: ", sys.exc_info()[0]
         dumpStack()Below is the output
    java weblogic.WLST test.py
    Initializing WebLogic Scripting Tool (WLST) ...
    Welcome to WebLogic Server Administration Scripting Shell
    Type help() for help on available commands
    Starting the script ...
    Connecting to t3://localhost:7001 with userid weblogic ...
    Successfully connected to Admin Server 'AdminServer' that belongs to domain 'Domain_7001'.
    Warning: An insecure protocol was used to connect to the
    server. To ensure on-the-wire security, the SSL port or
    Admin port should be used instead.
    Location changed to edit tree. This is a writable tree with
    DomainMBean as the root. To make changes you will need to start
    an edit session via startEdit().
    For more help, use help(edit)
    You already have an edit session in progress and hence WLST will
    continue with your edit session.
    Starting an edit session ...
    Started edit session, please be sure to save and activate your
    changes once you are done.
    MBean type JMSServer with name WLSTJMSServer has been created successfully.
    MBean type JMSSystemResource with name WLSTJmsSystemResource has been created successfully.
    Creating WLSTQueue1...
    Creating WLSTQueue2...
    Saving all your changes ...
    Saved all your changes successfully.
    Activating all your changes, this may take a while ...
    The edit lock associated with this edit session is released
    once the activation is completed.
    Activation completed
    script returns SUCCESSRegards,
    Ravish Mody
    http://middlewaremagic.com/weblogic
    Come, Join Us and Experience The Magic…
    Edited by: Ravish Mody-MiddewareMagic on Mar 16, 2011 8:33 PM

  • SYntax error - on Perform Statement

    Hello friends,
    I have a syntax error in the following code.
    the error is      The field "P_I_PA0000" is unknown, but there are the following fields          
    in the function module.
    Any suggestions.
    Thanks,
    Raju.
    PARAMETERS: ps_file1like rlgrap-filename         " Incoming file 1
                    DEFAULT 'c:\HR\ZCNV0008.txt' LOWER CASE,
    DATA:  BEGIN OF i_pa0000 OCCURS 100.
            INCLUDE STRUCTURE pa0000.
    DATA:  END OF i_pa0000.
      PERFORM upload_local_file USING ps_file1
                             CHANGING i_pa0000[].
    *&      Form  upload_local_file
          text
         -->P_PS_FILE1  text
         <--P_I_PA0000  text
    FORM upload_local_file  USING    p_ps_file1
                            CHANGING p_i_pa0000[].
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = p_ps_file1
          filetype                = 'ASC'
        TABLES
          data_tab                = p_i_pa0000[]
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
    ENDFORM.                    " upload_local_file

    If it doesn't work, why did you mark it as "solved"?
    I think this is what you are trying to do:
    PARAMETERS: ps_file1 LIKE rlgrap-filename " Incoming file 1
                DEFAULT 'c:\HR\ZCNV0008.txt' LOWER CASE.
    DATA: BEGIN OF i_pa0000 OCCURS 100.
            INCLUDE STRUCTURE pa0000.
    DATA: END OF i_pa0000.
    PERFORM upload_local_file
            TABLES i_pa0000
            USING ps_file1.
    *&      Form  upload_local_file
    *       text
    FORM upload_local_file
        TABLES p_i_pa0000
        USING p_ps_file1.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = p_ps_file1
          filetype                = 'ASC'
        TABLES
          data_tab                = p_i_pa0000
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
    ENDFORM. " upload_local_file
    Rob

  • Syntax error in 'UPDATE' query  ???

    hi..
    i know there is something wrong with this query..but not able to find it out.
    i am using session bean in my project..in one of the method of the bean class, i am updating 'Acc_holder' table.
    below is the code
    public String insDeposit(String vuserid, String vaccountno, int amount, int chqno)
      ...   //connection code
      Statement stmt=null;
      query="UPDATE Acc_holder SET balance=balance" + vamount + "WHERE userid=' "+vuserid+" ' ";
    }In above query, Acc_holder Table has balance(int), vamount(int), userid(varchar) fields.
    when i run, error msg that i get is "java.rmi.RemoteException...java.sql.SQLException:...Incorrect syntax near 'userid'.
    please suggest how this query should be formatted

    Use a prepared statement.
    And after you start doing that then put a space in front of the 'where'

Maybe you are looking for

  • On start up I hear the chime but nothing comes on display

    On start up I hear the start up chime but can not see anything on display but very vague images

  • KDE SC 4.5.0 moved to [extra]

    KDE SC 4.5.0 has moved into the [extra] repository. Notable changes with respect to previous releases are: * kdepim has seen no new release, please continue to use version 4.4.5 * due to incompatibility with ruby 1.9, ruby kdebindings are not provide

  • NOTHING seems to work

    I suppose it all started when my computer couldn't withstand the ipod's needs and I had to put it away until I got a firewire card, and I just got one. I installed the card and it LOOKS to work fine. Then....it happens...BOOM a problem, its a little

  • Administrative user can't access other accounts or delete remote login

    I have the administrative user account on my iMac at home. My daughter can't remember the new password I assigned her and needs me to change it. When I log into system preferences/accounts, it shows that I am the administrative user. However, when I

  • Newbie Muvo2 4GB File Deletion Question/Car Casse

    Hey Guys, Just got the Muvo2 Nomad from J&R. $40 after rebate. Anyway, I got it mainly to download MP3s of a radio broadcast. Each file is about 5MB in size, netting about 43 minutes of audio per file (@48k). At this rate, if my math is correct, the