Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Update varchar column in db2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
alluri12

New User


Joined: 15 Aug 2006
Posts: 44
Location: Virginia, USA

PostPosted: Wed Oct 07, 2009 7:41 pm    Post subject: Update varchar column in db2 table
Reply with quote

Hi,
Can somebody help me in resolving this sql

Code:
OWNER.TABLE
NM1              CM2          parm1
chr(3)          chr(4)        VARCHAR(60)
-----            ------        --------------------
AAA            BBBB         WHERE (FABLS_PRGMXLMS_TYP1 = 'MP')


Now i need to update the parm1 column with

Code:
UPDATE OWNER.TABLE                                       
 SET PARM1 = "WHERE (FABLS_PRGMXLMS_TYP1 IN ('MPS', 'MP')"
WHERE NM1 = 'AAA'                                     
AND     CM2 = 'BBBB';   


When i ran this query i am getting slqcode = -206
Back to top
View user's profile Send private message

GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Wed Oct 07, 2009 7:51 pm    Post subject:
Reply with quote

SQL isn't REXX
if you use quotes in a string you need to use two quotes (not double quote)

Code:
UPDATE OWNER.TABLE                                       
 SET PARM1 = 'WHERE (FABLS_PRGMXLMS_TYP1 IN (''MPS'', ''MP'')'
WHERE NM1 = 'AAA'                                     
AND     CM2 = 'BBBB';   
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Wed Oct 07, 2009 7:53 pm    Post subject:
Reply with quote

Please try this.

Code:
UPDATE OWNER.TABLE
 SET PARM1 = 'WHERE (FABLS_PRGMXLMS_TYP1 IN (''MPS'', ''MP'')'
WHERE NM1 = 'AAA'
AND     CM2 = 'BBBB';
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Wed Oct 07, 2009 7:57 pm    Post subject:
Reply with quote

I should have refreshed before posting. icon_wink.gif
Back to top
View user's profile Send private message
alluri12

New User


Joined: 15 Aug 2006
Posts: 44
Location: Virginia, USA

PostPosted: Wed Oct 07, 2009 8:26 pm    Post subject:
Reply with quote

It worked. thanks guyc
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us