469,148 Members | 1,539 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,148 developers. It's quick & easy.

SELECT and DECODE using LIKE??

Hello gurus,

I'm trying to do a search through an encrypted database (to which I
have the key). I want to use the LIKE operator in MySQL rather than
dumping out all entries and sorting in Perl, since MySQL will be much
faster at digging up the right information.

I'm not having any luck with the following (I'm using DBI in Perl, so
$ is Perl variable stuff):

SELECT(DECODE("Last_Name",$KEY) from $TABLE where
DECODE(Last_Name,$KEY) like "A%").

More exactly, my Perl DBI code looks like:

my $ps="SELECT DECODE(\"Last_Name\",\"$ACCOUNT_KEY\"),
DECODE(\"First_Name\",\"$ACCOUNT_KEY\"),
DECODE(\"SSN\",\"$ACCOUNT_KEY\") from $tablename WHERE
DECODE(Last_Name,\"$ACCOUNT_KEY\") LIKE \"$letter\")";

I've also tried quotes around the latter Last_Name, but that doesn't
work either. The idea is that I want SQL to decrypt the column entry
before performing the LIKE comparison.

Thanks,
Matt
oe******@mit.edu
Jul 19 '05 #1
0 2191

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by David Stephenson | last post: by
7 posts views Thread by andy vandenberghe | last post: by
reply views Thread by Matt Oefinger | last post: by
9 posts views Thread by Krishna Sagiraju | last post: by
2 posts views Thread by Amin Schoeib | last post: by
1 post views Thread by AR | last post: by
1 post views Thread by anonymous | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.