Αποτελέσματα Αναζήτησης
29 Δεκ 2014 · TO_DATE with proper format model should do the trick. Let's stick to a format model first. SQL> alter session set nls_date_format='dd/mm/yyyy hh24:mi:ss'; Session altered. Now, let's use TO_DATE to explicitly convert the string literal to date.
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.
15 Μαρ 2021 · Thanks. 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.
26 Ιαν 2018 · The CASE statement is conditional flow control syntax. Many languages have this feature. Oracle has implemented it in both PL/SQL and into the SQL engine. 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).
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.
11 Νοε 2019 · I've run autotrace for each of the following queries: select case when my_date = to_date('99991231','YYYYMMDD') then 'A' else 'B' end from my_table; and select case when to_char(my_date,'YYYYMMDD') = '99991231' then 'A' else 'B' end from my_table; But it returns identical output: 7 recursive calls 52 db block gets 59 physical reads 139 redo size
2 Ιουν 2023 · The CASE statement allows you to perform an IF-THEN-ELSE check within an SQL statement. It’s good for displaying a value in the SELECT query based on logic that you have defined. As the data for columns can vary from row to row, using a CASE SQL expression can help make your data more readable and useful to the user or to the application.