|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Escaping apostrophe |
« View previous topic :: View next topic » |
Author |
Message
|
domoku_1 |
Posted: Thu Jan 12, 2012 2:27 pm Post subject: Escaping apostrophe |
|
|
Newbie
Joined: 12 Jan 2012 Posts: 6
|
Hi,
I’m looking for inputs on this problem.
My input xml has an element <Desc>, this element is used to query a db table, the issue occurs when this field has an apostrophe value in it.
PASSTHRU ('SELECT ABC FROM TTT_T
WHERE xyz = ''' || Root.XMLNSC…..:Desc || ''')
When Desc = ‘DAD’S WATCH’, the code throws up a badly formed sql exception which is expected. I tried looking for ‘ in the element and then replacing it with “ which did not work as expected. I will try escaping it with ‘ itself.
Is there a better way of achieving this?
Thank you |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Jan 13, 2012 2:46 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
I'm not sure why this is difficult. This is an SQL question, not a WMB question.
http://www.michael-thomas.com/tech/db2/db2_survival_guide.htm
Quote: |
Escape character. To insert a single quote, use 2 single quotes ( '' ). To insert pet's use the following pet''s. Example: insert into MYTABLE (question,answer) values ('What is your pet''s name?','blacky') |
Therefore, you will need to write ESQL code to scan the string and escape single apostrophes. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
domoku_1 |
Posted: Sun Jan 15, 2012 7:58 pm Post subject: |
|
|
Newbie
Joined: 12 Jan 2012 Posts: 6
|
Thank you,
yea that is what I did in the end and it worked fine. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|