Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2006
    Posts
    2

    Unanswered: SQL0511N The FOR UPDATE clause is not allowed because the table specified by the....

    I am getting error

    " com.ibm.db.DataException: A
    database manager error occurred. : [IBM][CLI Driver][DB2/NT]
    SQL0511N The FOR UPDATE clause is not allowed because the
    table specified by the cursor cannot be modified.
    SQLSTATE=42829 "

    on executing query

    select m.msgtyp, m.msg, m.msg_id, md.devcod from mtfmsg m
    , mtfmsg_delv md
    where
    md.msg_id = m.msg_id and
    md.rcvflg = 0 and
    md.rcvdte is null and
    (md.expdte is null or current timestamp < md.expdte) and
    md.devcod = 'TEL02W'
    order by md.insdte
    for update of rcvdte

    on UDB DB2 client. I think multiple table columns or joins with for update clause is not supported in DB2.Is there any alternate solution ? Please help me in resolving this problem

  2. #2
    Join Date
    Apr 2006
    Posts
    8
    why do you use "order by " ?

  3. #3
    Join Date
    Apr 2006
    Posts
    2
    Here order by clause doesn't cause any problem only issue is select statment for multiple table columns with for update clause. is there any alternate oproach ?

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    which column(s) do you want to update ?
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Apr 2006
    Posts
    8
    The db2 explain that:
    db2 => ? SQL0511N


    SQL0511N The FOR UPDATE clause is not allowed because the table
    specified by the cursor cannot be modified.

    Explanation:

    The result table of the SELECT or VALUES statement cannot be
    updated.

    On the database manager, the result table is read-only if the
    cursor is based on a VALUES statement or the SELECT statement
    contains any of the following:

    o The DISTINCT keyword

    o A column function in the SELECT list

    o A GROUP BY or HAVING clause

    o A FROM clause that identifies one of the following:

    - More than one table or view

    - A read-only view

    - An OUTER clause with a typed table or typed view

    o A set operator (other than UNION ALL).



    The point :More than one table or view ,so i think you are right .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •