Αποτελέσματα Αναζήτησης
select case substr(status,1,1) -- you're only interested in the first character. when 'a' then 'Active'. when 'i' then 'Inactive'. when 't' then 'Terminated'. end as statustext. from stage.tst. However, there's a few worrying things about this schema.
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. Oracle CASE expression has two formats: the simple CASE expression and the searched CASE expression. Both formats support an optional ELSE clause.
Is there a "better" way to rewrite a SELECT clause where multiple columns use the same CASE WHEN conditions so that the conditions are only checked once? See the example below.
15 Μαρ 2021 · You can use a SCALAR SUBQUERY - a query that returns zero or one rows with exactly one column. So this will work: 1* select case when dummy = 'X' then (select count(*) from all_users) else (select count(*) from dual) end cnt from dual ops$tkyte%ORA10GR2> / CNT ----- 46
This Oracle tutorial explains how to use the Oracle / PLSQL CASE statement with syntax and examples. The Oracle / PLSQL CASE statement has the functionality of an IF-THEN-ELSE statement. Starting in Oracle 9i, you can use the CASE statement within a SQL statement.
26 Ιαν 2018 · In PL/SQL, there are two flavors. First, the CASE statement evaluates the contents of a variable and returns a value (implemented as a function). I refer to this version of the CASE statement as Format 1; Oracle calls it a Simple CASE statement.
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;} ...