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 » Sort letters in word in alphabetical order

Post new topic  Reply to topic
 Sort letters in word in alphabetical order « View previous topic :: View next topic » 
Author Message
akidase
PostPosted: Mon Oct 17, 2011 9:06 pm    Post subject: Sort letters in word in alphabetical order Reply with quote

Centurion

Joined: 10 Jan 2011
Posts: 124

Any function for it ?
Back to top
View user's profile Send private message
akidase
PostPosted: Mon Oct 17, 2011 11:21 pm    Post subject: Reply with quote

Centurion

Joined: 10 Jan 2011
Posts: 124

CREATE FUNCTION SortLettersInWord (IN input CHARACTER) RETURNS CHARACTER
BEGIN

DECLARE chOut CHARACTER '';
DECLARE lenCh INTEGER LENGTH(input);
DECLARE cnt,cnt2 INTEGER 1;
DECLARE posStr INTEGER 1;

WHILE cnt<=lenCh DO

-- Get the Character to be traversed.
DECLARE getCh CHARACTER SUBSTRING(input FROM posStr FOR 1);

-- Get the least possible letter.
WHILE cnt2<=lenCh DO
DECLARE preCh CHARACTER SUBSTRING(input FROM cnt2 FOR 1);
IF preCh <=getCh THEN
set chOut= preCh||chOut;
END IF;
SET cnt2=cnt2+1;
END WHILE;
SET posStr=posStr+1;
SET cnt=cnt+1;
END WHILE;

RETURN chOut;
END;
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 » Sort letters in word in alphabetical order
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.