List:General Discussion« Previous MessageNext Message »
From:John Trammell Date:February 4 2005 9:31pm
Subject:RE: ENCODE & DECODE
View as plain text  
In my version of MySQL (4.1.9), your sample code generates an error:

mysql> select decode(encode("foo"));
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '))' at line 1

Apparently encode()/decode() take two args, at least on my version of
MySQL:

mysql> select decode(encode("foo","bar"),"bar");
+-----------------------------------+
| decode(encode("foo","bar"),"bar") |
+-----------------------------------+
| foo                               |
+-----------------------------------+
1 row in set (0.00 sec) 

> -----Original Message-----
> From: Jeff Smelser [mailto:tradergt@stripped] 
> Sent: Friday, February 04, 2005 2:14 PM
> To: mysql@stripped
> Subject: Re: ENCODE & DECODE
> 
> On Friday 04 February 2005 11:00 am, shaun thornburgh wrote:
> > Apparently not!
> >
> > mysql> SELECT DECODE ( CSV_DATA_ENC_FORENAME, "test_password" ) FROM
> > DATA_TABLE_PID_1_DESC_137;
> 
> Is it so hard to read directions?
> 
> select decode(csv_data_enc_forename) from DATA_TABLE_PID_1_DESC_137;
> 
> This assumes whatever is in that column, was encoded.
> 
> Jeff
> 
Thread
ENCODE & DECODEshaun thornburgh4 Feb
  • Re: ENCODE & DECODEJeff Smelser4 Feb
    • Re: ENCODE & DECODEshaun thornburgh4 Feb
      • Re: ENCODE & DECODEGleb Paharenko4 Feb
      • Re: ENCODE & DECODEJeff Smelser4 Feb
RE: ENCODE & DECODEJohn Trammell4 Feb
  • Re: ENCODE & DECODEJeff Smelser4 Feb