Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009
    Posts
    46

    Unanswered: How Do You Run an Update Statement in DB2?

    I've only done this in SQL, and not even show my code is right for SQL. I'm trying to wipe out value in a field so it is empty. I wrote this:

    Code:
    
    BEGIN TRANSACTION
    update DSNP.PR01_T_USER_TRAN
    set user_q_cd = NUll
    where user_id_cd = 3881
    and user_tran_cd = 'PR41'
    ROLLBACK TRANSACTION
    Does this look right? It fails with an error

    An EXECUTE IMMEDIATE statement contains a SELECT or VALUES statement.

    Thanks.

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    Your code looks like MS SQL Server, because:
    BEGIN TRANSACTION does not exist in DB2 (as DB2 automatically starts a transaction when it has to)
    ROLLBACK TRANSACTION is not a valid DB2 statement - DB2 has ROLLBACK
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

Posting Permissions

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