The MySQL allows you to write complex conditional construct with the help of CASE operator. In other words, CASE operator for stored programs implements a complex conditional construct.
To write complex conditional construct, use the following syntax:
Parameters:
tablename: The table name from which you want to fetch the records.
condition: To check conditions is true or not.
result: If condition fails, return default result.
Note:
In the above example, we are checking each string in "firstName" column, if value = "Dilip" then return "Found" value else return "Not Found" value as result.
You can use MySQL Command Line Client to write complex conditional construct in a stored program. It will look like this: