Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2014
    Posts
    10

    Unanswered: Problem in updating table value

    Hi,

    Currently I am facing very weird problem while using update statement.
    I have table named 'employee' with following three columns:
    Name Varchar(25), Address Varchar(25), Reserved Varchar (25).

    I have created a stored procedure with one input variable as 'incoming' and under that put two update statements almost identical with same value to be updated. First update statement is not making any updation whereas second updation is making updation. syntax used as
    UPDATE EMPLOYEE
    SET ADDRESS = 'LABORER'
    WHERE EMPNO = incoming;
    UPDATE EMPLOYEE
    SET RESERVED = 'LABORER'
    WHERE EMPNO = incoming;


    I have no clue why column 'address' is not having updation while in same record and table another column named 'reserved' is having updation. I am using DB2 9.7 ESE LUW.

    Please provide the solution.

    Thanks in advance.
    Last edited by sanygup; 01-31-14 at 11:51. Reason: small typgrahic problem

  2. #2
    Join Date
    May 2005
    Posts
    29
    if the EMPNO is the same value, why don't just do a single UPDATE command like this

    UPDATE EMPLOYEE
    SET ADDRESS = 'LABORER', RESERVED = 'LABORER'
    where EMPNO = incoming;

    Try getting the return code of the update, also try running the output manually to see if it works to make sure

  3. #3
    Join Date
    Jan 2014
    Posts
    10
    Quote Originally Posted by db2inst1 View Post
    if the EMPNO is the same value, why don't just do a single UPDATE command like this

    UPDATE EMPLOYEE
    SET ADDRESS = 'LABORER', RESERVED = 'LABORER'
    where EMPNO = incoming;

    Try getting the return code of the update, also try running the output manually to see if it works to make sure
    Thanks for replying.

    I have tried the same syntax which you have proposed but with no success. When I run the update manually it works fine. but not with procedure.

    Can you please tell me how to get the return code of update.

  4. #4
    Join Date
    Jan 2014
    Posts
    10

    Re:

    Dear Friend,

    I have already tried to use to combine the update for both statements but no success. Can you please tell me how to get the update reply code.

    Thanks.

  5. #5
    Join Date
    Jan 2014
    Posts
    10

    Please reply need forum help

    Hello dbforum,

    Please reply to my query.

    Dear Db2inst1,

    I have tried your solution but with no success.

    Please tell me how to get the return code for update.

  6. #6
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    I have tried your solution but with no success.
    What query did you tried?

    What means "no success"?
    Did you received error/warning messages?
    or
    The result was different from your expectations?

    Please describe your tried query(considering suggestions of db2inst1) and the issues more concretely.

  7. #7
    Join Date
    Jan 2014
    Posts
    10

    Thanks Tonkuma for replying

    Quote Originally Posted by tonkuma View Post
    What query did you tried?

    What means "no success"?
    Did you received error/warning messages?
    or
    The result was different from your expectations?

    Please describe your tried query(considering suggestions of db2inst1) and the issues more concretely.
    By "no success" I meant that same unexpected result is coming with no error message. First column 'Address' is getting null and subsequent column 'Reserved' is having the value filled.

    I have used the query as :
    UPDATE EMPLOYEE
    SET ADDRESS = 'LABORER', RESERVED = 'LABORER'
    where EMPNO = incoming;

    Thanks

Tags for this Thread

Posting Permissions

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