About 206,000 results
Open links in new tab
  1. CASE .. WHEN expression in Oracle SQL - Stack Overflow

    SELECT status, CASE status WHEN 'a1' THEN 'Active' WHEN 'a2' THEN 'Active' WHEN 'a3' THEN 'Active' WHEN 'i' THEN 'Inactive' WHEN 't' THEN 'Terminated' END AS StatusText FROM stage.tst Is there any other way of doing this where I don't need to write When expression 3 times for Active Status and the entire active status can be checked in one ...

  2. Conditional WHERE clause with CASE statement in Oracle

    We can use a CASE statement in WHERE clause as: SELECT employee_no, name, department_no FROM emps WHERE (CASE WHEN :p_dept_no = 50 THEN 0 WHEN :p_dept_no = 70 THEN 0 ELSE -1 END) = 0;

  3. sql - How to use select statement in CASE WHEN ELSE statement …

    May 6, 2015 · select user_id,case when pr_user_id IS NOT NULL then user_name else 'NO PR_USER' end as primary_user_name from user_name; It displays the below result Share

  4. sql - CASE condition with IN clause in Oracle - Stack Overflow

    May 5, 2015 · The case statement is an expression that returns a single value. If you want to use case , then you need to return a value and do a comparison: (CASE order_date > sysdate and fee_rate_type in ('REGULAR', 'BONUS') then 1 order_date <= sysdate and FEE_RATE_TYPE in ('REGULAR') then 1 END) = 1

  5. oracle database - How to use If condition inside a Case statement ...

    Feb 29, 2012 · SQL> select case when value in (1000) then null 2 when user in ('ABC') then user 3 when area in ('DENVER') then 4 if value = 2000 then 'Service1' 5 else value = 3000 then 'Service2' 6 end if 7 else null 8 end as num_code from service_usoc_ref; if prin = 2000 then 'Omaha' * ERROR at line 4: ORA-00905: missing keyword

  6. CONCATENATE a CASE in Oracle SQL - Stack Overflow

    Sep 27, 2013 · I need to run a CASE expression on a number of columns, the columns are Boolean, so if it's 0 I need to populate the column with the column name and if it's 1, I ignore the column/value. I then need to concatenate all these columns into one. Is it possible to do this in Oracle SQL? I've tried this:

  7. oracle sql - select statement with multiple "case when" and check …

    Jul 11, 2016 · Else "No Match" is invalid SQL (unless you have a column that is named No Match). Also contains()` is an Oracle Full Text function and requires a different syntax then the one you are using. Also contains()` is an Oracle Full Text function and requires a different syntax then the one you are using.

  8. sql - Case Statement on Multiple conditions in Oracle - Stack …

    Oct 25, 2016 · Oracle SQL CASE statement checking multiple conditions. 2. use of condition with CASE on oracle sql. 1 ...

  9. How to use case statement inside where clause in oracle?

    Oct 20, 2016 · It is not an assignment but a relational operator. The result of the case statement is either 1 or 0. You select only the records where the case statement results in a 1. Thanks for accepting this as the answer but Tony Andrews solution is a lot more straightforward and, in my view, the better answer. –

  10. returning multiple columns using Case in Select Satement in Oracle

    Jun 16, 2011 · If each case only allows one column, then you probably need two cases: select col1,col2, case when col3='E01089001' then (select 1 from dual) else (select 2 from dual) end, case when col3='E01089001' then (select 3 from dual) else (select 4 from dual) end from Table1 where col1='A0529';

Refresh