Tip Details Add a Related Tip

Rate as: Positive Negative

MySQL Decode Equivalent

For all of you former Oracle users that are now using MySQL and looking for a MySQL equivalent to the DECODE statement in Oracle, the command you want is IF. Unlike the DECODE statement it takes one fewer parameter, the first parameter is an expression so you don't have to give two parameters to figure out which value to return. But aside from that, IF behaves just like DECODE. You can read about the statement in the MySQL doc pages here: http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_if
Rating: 100% positive, 1 Vote
Categories: MySQL Oracle databases
Added: on Jul 10, 2008 at 5:00 pm
Added By: an anonymous user
Searches: mysql oracle decode database statement

Comments on this Tip

Add a Comment
There are no comments for this tip
Your Comment:
(how to format)
Rate This Tip:

Verify Humanity:
Sorry, we know it's annoying, but please enter the characters shown in the image to the left so that we know you're an actual person and not an evil spammer. Thanks.
       

Related Tips

Finding slow MySQL queries

100% positive, 0 comments
– Tip added by dbdude on Jun 24, 2008 at 9:22 pm

Optimize your MySQL database

100% positive, 0 comments
– Tip added by an anonymous user on Dec 07, 2008 at 5:04 pm

MySQL equivalent to Oracle NVL

Categories: MySQL Oracle database
no ratings, 0 comments
– Tip added by an anonymous user on Jul 31, 2009 at 4:01 pm

Oracle decode error

Categories: Oracle databases errors
no ratings, 0 comments
– Tip added by an anonymous user on Dec 01, 2008 at 10:08 am

Optimizing your MySQL tables

no ratings, 0 comments
– Tip added by an anonymous user on Oct 21, 2008 at 11:18 am

Why you should use MySQL

no ratings, 0 comments
– Tip added by an anonymous user on May 30, 2007 at 10:02 am

MySQLi Dumper

75% positive, 0 comments
– Tip added by an anonymous user on Feb 18, 2009 at 11:30 am

How to find a good and cheap web hosting?

100% positive, 0 comments
– Tip added by an anonymous user on Mar 24, 2008 at 3:15 am

The table mysql.proc is missing, corrupt, or contains bad data

Categories: MySQL repair database
100% positive, 0 comments
– Tip added by an anonymous user on Oct 01, 2009 at 10:07 pm

Speed up iPhoto load time

Categories: iPhoto speed databases
50% positive, 0 comments
– Tip added by an anonymous user on Mar 02, 2009 at 4:03 pm

Minimize round trips to the server for best performance

100% positive, 0 comments
– Tip added by an anonymous user on Jun 18, 2008 at 4:07 pm

Importing databases in MS SQL

100% positive, 0 comments
– Tip added by an anonymous user on May 29, 2008 at 2:47 pm

Delete Records With Effect Using jQuery And PHP

Categories: php jQuery MySQL
no ratings, 0 comments
– Tip added by an anonymous user on Sep 27, 2009 at 7:10 am

Disable the SQL Server splash screen

no ratings, 0 comments
– Tip added by an anonymous user on Oct 14, 2008 at 8:23 am