> Yuk. It works on Oracle too, although I personally think it's nasty in
> concept.
I agree ;-)
However, I think getting the DB to return an address first time, rather than
failing, then issuing a second query to the DB is more efficient.
> Another possibility is:
> (note that I've removed lower() calls and $quote_.. clauses for clarity)
>
> SELECT destination FROM user_aliases
> WHERE localpart IN ('$local_part', '%') AND domain = '$domain'
> AND rownum <= 1
>
> which does two unique scans rather than a range scan. If you have enough
> entries to justify using an index at all, mind you :}
>
> SRH
Good one. Much nicer.
You could use "IN ('$local_part','*')" to remain in keeping with the
concept of * being the default.
The fexibility of being able to pattern match does appeal to me however,
although there are lots of precedence issues down that road...
Regards,
Mark.
Salamis Group of Companies -
WWW.SALAMISGROUP.COM
This communication contains information which is confidential and may
also be privileged. It is for the exclusive use of the intended
recipient(s). If you are not the intended recipient(s) be advised
that any form of distribution, copying or use of this communication
or the information it contains is strictly prohibited and may be
unlawful. We apologise if you have received this communication in
error. Please return it to the sender immediately, delete this
communication from your computer and destroy any copies of it. Any
views/opinions expressed in this email are that of the author and may
not reflect the views of Salamis (M&I)Ltd.