1 Nov 2011 16:05
Re: [U2] Using 'MATCH'
Charles Stevenson <stevenson.chas <at> gmail.com>
2011-11-01 15:05:11 GMT
2011-11-01 15:05:11 GMT
What Wol & George Smith said.
MATCH's raison d'etre is _PATTERN_ matching.
That means:
(a) MATCH is relatively expensive to use for comparing simple literals.
(b) For MATCH, you need to enclose the pattern's literals in embedded
quotes to ensure that it is not interpreted as a pattern.
Per Wol's "M6AWT" example: M6AWT needs to be "'MCAWT'" or MATCH will
reinterpret it as "'M'6A'WT'", a 3-piece pattern.
Remember, every time MATCH is going to examine the 2nd argument to
figure out what pattern you're talking about this time, which brings us
back to point (a).
(c) MATCH will be confusing to the next maint pgmr: he'll think you're
talking about PATTERN matching, not simple literals.
George's INDEX() gets it right for shear efficiency,
On 10/31/2011 2:17 PM, George Smith wrote:
> If you are trying to look for an arbitrary delimited string, I think
> the safest thing to do is something like IF INDEX(',':X.STRING:',',
> ',':X.CODE:',',1)=0 THEN X.STRING=X.STRING:',':X.CODE
Efficiency matters if you do many iterations.
The LOCATE suggestions are arguably more readable if the rookie pgmr
following you is not familiar with the INDEX() technique (yet).
You may be surprised if you compare INDEX() performance to functionally
(Continue reading)
RSS Feed