Date: Thu, 2 Jan 2014 17:55:08 +0200
Subject: Re: SQL Reverse function
Apologies, due to end of year rush I had to neglect this forum.
Yes it is a very peculiar local (Bidi) situation with CCSID 424 (Hebrew)
Hebrew is read Right to left so description text fields are populated
Right to left starting at the right-most pos (424 is I believe
Numbers however, we read left to right.
English letters Address example:
MAIN ST12 is stored as
SIDE ST8 is stored as
when displaying/printing the address we use the raw data
but in order to sort correctly we need to Reverse the data
otherwise SIDE ST8 will precede MAIN ST12 due to "SIDE ST8" 's shorter
Select CustNo, CustName, CustAddress
order by Reverse(CustAddress)
Simply flipping the data will get you MAIN ST21 instead of MAIN ST12
So numbers (and English words as well) should remain intact.
Hope this clears the issue
1. Re: SQL Reverse Function (CRPence)
date: Fri, 20 Dec 2013 11:12:00 -0800
from: CRPence <CRPbottle@xxxxxxxxx>
subject: Re: SQL Reverse Function
On 20-Dec-2013 07:28 -0800, Vernon Hamberg wrote:
On 12/19/2013 11:21 PM, John Yeung wrote:
On Thu, Dec 19, 2013 at 10:38 PM, Gad Miron wrote:
I neglected to mention that there might be numbers embedded in
the string, The numbers needs to remain intact.
Given a 'ab123cd' string, a simple reverse will get me cd321ba
instead of dc123ba
That is quite an unusual requirement. If I may ask, what do you
need that for?
Good question - I can think of one possibility - if the string is
overloaded with multiple values - region, district, area (not good
examples, I know), then there may be a desire to leave certain items
in situ and swap others for some reason.
Which raises for me the thought that this is VERY specific to a local
requirement and doesn't line up well for generalization. If the
string were 'a1b2c3d', then by Gad's requirement, reversing alpha
only would be 'd1c2b3a'.
Or for an attempt to display data that is apparent BiDirectional
(BIDI) data; i.e. reformat the data currently stored as left-to-right
data to be presented\read as right-to-left data, while leaving any
embedded /numeric/ data in-tact. But the requirements would be much
more complicated than as-stated\alluded. Even if not so complex, there
is still way too little information to make a good suggestion. I have a
function that does exactly what both of those _very simple examples_
imply would be the expected result, but I would be hesitant to share
that as a possible solution without knowing what are the requirements;
i.e. overly-simplified examples are not requirements.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives