Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Update a column to HEX value from DB2

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

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Tue Jan 17, 2012 4:09 pm    Post subject: Update a column to HEX value from DB2
Reply with quote

Hi ,
I need to update a column in the table whose Hex equivalent should be equal to 01.

Quote:
UPDATE Table A
SET Col1 = (SUBSTR(Col1,11,1),X'01')
WHERE A= 999
and B= 99
and c = 'ST';COMMIT;;;;

when ran the above query in SPUFI it gives me the below error

Quote:

SQLCODE = -104, ERROR: ILLEGAL SYMBOL ",". SOME SYMBOLS THAT MIGHT
BE LEGAL ARE: MICROSECONDS MICROSECOND SECONDS SECOND MINUTES MINUTE
HOURS


even I tried with the
Quote:

UPDATE Table A
SET Col1 = (SUBSTR(Col1,11,1),HEX'01')
WHERE A= 999
and B= 99
and c = 'ST';COMMIT;;;


Is there any way that i directly update the value to a HEX equivalent
Back to top
View user's profile Send private message

gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Jan 17, 2012 5:08 pm    Post subject:
Reply with quote

Hex Function -
The HEX function returns a hexadecimal representation of a value.
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Wed Jan 18, 2012 10:20 am    Post subject:
Reply with quote

Hi,

your requirement is not clear.

What exactly you want to do?
you want to update COL1 when it's Hex equivalent should be equal to 01 or you want to update COL1 to hex equivalent of 01

Can you please elaborate on requirement
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Wed Jan 18, 2012 2:50 pm    Post subject:
Reply with quote

I want to update the col1 to hex equivalent of 01
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1544
Location: Andromeda Galaxy

PostPosted: Wed Jan 18, 2012 7:12 pm    Post subject:
Reply with quote

Technokrat,

Observations:

1.You said you wanted to updated hex equivalnet of 01 but it is SUBSTR(Col1,11,1),X'01') ( Still I am clueless what is needed here)
2.Col1 = (SUBSTR(Col1,11,1),X'01') guess it should be Col1 = SUBSTR(Col1,11,1)||X'01'
3.In your next reply please use code tags and show us sample input data and sample output data considering X'01' is a '.'
4.Failing reply for the above observations you may not get a reply
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jan 18, 2012 7:52 pm    Post subject:
Reply with quote

[quote="premkrishnan"]3.In your next reply please use code tags and show us sample input data and sample output data considering X'01' is a '.'


No x'01' is not a '.' it is a non-displayable character that often is displayed as a '.' but it is definitely not a '.' which in EBCDIC is a hex'4b' or in ASCII is a x'2e'.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1544
Location: Andromeda Galaxy

PostPosted: Wed Jan 18, 2012 7:58 pm    Post subject:
Reply with quote

Hi Craq,

I understand that but I just wanted Technokrat to display the x'01' as '.'
like assume icon_smile.gif
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us