Αποτελέσματα Αναζήτησης
15 Μαρ 2012 · 3 Answers. Sorted by: 17. select decode(type_id, null, 'Unknown', type_id), name, count(*) from. ( select 'asdf' type_id, 'name1' name from dual union all. select 'asdf' type_id, 'name2' name from dual union all. select null type_id, 'name3' name from dual. ) test_table. group by type_id,name;
1 Ιουν 2023 · Oracle DECODE Function with NULL Values. As I mentioned above, the Oracle DECODE function is an exception to other functions in how it handles NULL values. It treats a NULL expression and NULL search as equal (so NULL == NULL). So, this example will return 1: SELECT DECODE(NULL, NULL, 1, 0) FROM DUAL;
12 Οκτ 2022 · In order to use the sign function, we first need to map the "Low" range to negative numbers, the "Medium" range to 0, and the "High" range to positive numbers. This mapping can be done with this expression: floor((x - :low_th) / (:high_th - :low_th)) And now it's easy to write the final query:
9 Ιαν 2014 · SELECT 1 FROM DUAL WHERE NVL (NULL, '-1') = NVL (NULL, '-1') SELECT 1 FROM DUAL WHERE DECODE (NULL, NULL, '1', '0') = '1'. Both will evaluate nulls as being equal. I was just curious which would perform better as I have to have about 30 of these statements together in a case statement.
SELECT DECODE (NULL, NULL, 'Equal', 'Not equal') FROM dual; Code language: SQL (Structured Query Language) (sql) In this tutorial, you have learned how to use the Oracle DECODE() function to add procedure if-then-else logic to SQL queries.
28 Ιαν 2008 · e.item_number = decode ( ' {@parameter_name}', null, e.item_number, to_number ( ' {@parameter_name}' ) ) and why is it not the same as: if ( ' {@parameter_name}' is null then, e.item_number = e.item_number (or a no-op) else. e.item_number = to_number ( ' {@parameter_name}' ) end if.
5 Ιουλ 2016 · SELECT least ( DECODE (:VAR1, 9999, NULL, :VAR1), DECODE (:VAR2,9999, NULL,:VAR2) ) FROM DUAL; VAR1 & VAR2 need to be NUMBERs (not varchar) the above SQL seems to work for all numbers except for the range of 100 to 149 (positive numbers ) For example : when VAR1 = 125 and VAR2 = 15