Αποτελέσματα Αναζήτησης
You can rewrite it to use the ELSE condition of a CASE: SELECT status, CASE status WHEN 'i' THEN 'Inactive' WHEN 't' THEN 'Terminated' ELSE 'Active' END AS StatusText FROM stage.tst
You can use a CASE expression in any statement or clause that accepts a valid expression. For example, you can use the CASE expression in statements such as SELECT , UPDATE , or DELETE , and in clauses like SELECT , WHERE , HAVING , and ORDDER BY .
26 Φεβ 2016 · The problem is that Oracle evaluates the SELECT after the WHERE clause. You can either put your query in a subselect:
The CASE function specifies conditions and results for a select or update statement. You can use the CASE function to search for data based on specific conditions or to update values based on a condition. Example. SELECT CASE JOB WHEN 'PRESIDENT' THEN 'The Honorable' WHEN 'MANAGER' THEN 'The Esteemed' ELSE 'The good' END, ENAME FROM EMP;
In a simple CASE expression, Oracle Database searches for the first WHEN... THEN pair for which expr is equal to comparison_expr and returns return_expr. If none of the WHEN... THEN pairs meet this condition, and an ELSE clause exists, then Oracle returns else_expr. Otherwise, Oracle returns null.
The CASE statement evaluates a single expression and compares it against several potential values, or evaluates multiple Boolean expressions and chooses the first one that is TRUE. Syntax. searched_case_statement ::= [ <<label_name>> ] CASE { WHEN boolean_expression THEN {statement;} ... }... [ ELSE {statement;}... ] END CASE [ label_name ...
3 Μαρ 2009 · You are giving TRUNC a format mask -- one that you might use on a date with the to_char() function (eg: given a date and the format mask dd-mon-yy, it will format the 7 byte binary date into that character string).