You can include CASE expressions inside SQL queries, for example instead of a call to the DECODE function or some other function that translates from one value to another. Examples Example 13-shows the use of a simple CASE statement. Am i missing something in the above case statement? How to return multiple values using case. Or if video is more your thing,.
The Oracle 8i release introduced the CASE expression. Moreover, using the CASE function, multiple conditions provided in separate SQL queries can be combined into one, thus avoiding multiple statements on the same table (example given below). The function is available from Oracle 8i onwards.
The CASE expression evaluates a list of conditions and returns one of the multiple possible. Oracle CASE expression allows you to add if-else logic to SQL statements without having to call a procedure. Can XPress handle the first case statement below? Starting in Oracle 9i, you can use the CASE statement within a SQL statement. Rather than putting the data in a case statement where you might have to repeat that case statement in more than one query, you could create a table with static data, then joint to that table.
The advantage would be that you can change the data in the table easier than changing all of the queries that have that case statement.