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 » Concatenating spaces

Post new topic  Reply to topic
 Concatenating spaces « View previous topic :: View next topic » 
Author Message
Ching
PostPosted: Tue Mar 08, 2005 7:37 pm    Post subject: Concatenating spaces Reply with quote

Apprentice

Joined: 08 Nov 2004
Posts: 25
Location: Portland, OR

I want to concatenate spaces to characters.

For example:

Let variableA = A, variableB = , variableC = C.

I want an out put:

A C

-----------------------------------------------
In my esql I have something like:


SET concatField = COALESCE(variableA, SPACE(1))||COALESCE(variableB,SPACE(1))||COALESCE(variableC,SPACE(1));

-----------------------------------------------
since B is empty, with coalesce it should concatenate a space right?

What I'm actually getting is:

AB
-------------------------------------
What happened to the space?

Thanks for any suggestions.
Ching
Back to top
View user's profile Send private message Send e-mail
Ching
PostPosted: Tue Mar 08, 2005 8:11 pm    Post subject: Reply with quote

Apprentice

Joined: 08 Nov 2004
Posts: 25
Location: Portland, OR

since variableB exists, coalesce will concat empty with A and B.

So that's why output is AB.

I think I've answered my own question.

Ching
Back to top
View user's profile Send private message Send e-mail
protocol
PostPosted: Tue Mar 08, 2005 10:57 pm    Post subject: Reply with quote

Apprentice

Joined: 25 Feb 2005
Posts: 41

Hi Ching,
The result is as expected.

If you want 'A B' then assign variable B = ' ' or better still use :

SET concatField =
COALESCE(variableA, SPACE(1))||' '||COALESCE(variableC,SPACE(1));




Protocol
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Mar 09, 2005 4:40 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

variableB is empty.

Empty is not the same as NULL.

Coalesce only uses the default value when the field is NULL.
_________________
I am *not* the model of the modern major general.
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 » Concatenating spaces
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.