Αποτελέσματα Αναζήτησης
16 Ιαν 2011 · I am trying to find an equivalent of DECODE function in MySQL. It works like this: Select Name, DECODE(Age, 13,'Thirteen',14,'Fourteen',15,'Fifteen',16,'Sixteen', 17,'Seventeen',18,'Eighteen',19,'Nineteen', 'Adult') AS AgeBracket. FROM Person.
1 Ιουν 2023 · The purpose of the Oracle DECODE function is to perform an IF-THEN-ELSE function. It’s similar to a CASE statement, but CASE is a statement where DECODE is a function. It allows you to provide a value, and then evaluate other values against it and show different results.
Introduction to Oracle DECODE() function. The Oracle DECODE() function allows you to add the procedural if-then-else logic to the query. In the following example, the Oracle DECODE() function compares the first argument (1) with the second argument (1).
SELECT DECODE (3, 1, 'Equal 1,', 2, 'Equal 2', 'Not Equal 1 or 2'); Code language: SQL (Structured Query Language) (sql) This example works like the following IF-THEN-ELSEIF-ELSE statement: IF 3 = 1 THEN RETURN 'Equal 1'; ELSE IF 3 =2 THEN RETURN 'Equal 2'; ELSE RETURN 'Not Equal 1 or 2'; END IF ; Code language: SQL (Structured Query Language ...
6 Αυγ 2024 · This tutorial provides a comprehensive guide to using the SQL DECODE() function in Oracle. I will also compare DECODE() to CASE WHEN in Oracle and help you understand when to use each function. Finally, I will provide code for the equivalent transformations in SQL Server, PostgreSQL, and MySQL.
DECODE function: The syntax for the DECODE function is as follows: DECODE(expression, search1, result1, [search2, result2, ...], [default]) Parameters: expression: The value or column to be evaluated. searchN: The search value to compare with the expression.
This Oracle tutorial explains how to use the Oracle / PLSQL DECODE function with syntax and examples. The Oracle / PLSQL DECODE function has the functionality of an IF-THEN-ELSE statement.