ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Escaping apostrophe

Post new topic  Reply to topic
 Escaping apostrophe « View previous topic :: View next topic » 
Author Message
domoku_1
PostPosted: Thu Jan 12, 2012 2:27 pm    Post subject: Escaping apostrophe Reply with quote

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
View user's profile Send private message
lancelotlinc
PostPosted: Fri Jan 13, 2012 2:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
domoku_1
PostPosted: Sun Jan 15, 2012 7:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Escaping apostrophe
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.