About 1,580,000 results
Open links in new tab
  1. IF-THEN logic in SELECT and WHERE with CASE expressions in Oracle SQL

    Dec 7, 2023 · If you want to do if-else-then logic in select, where or anywhere else in a statement, you need a case expression. This is a series of when clauses that the database runs in order: For example, if you want to map exam correct percentages to grade letters according to these rules: You can use a case expression like this:

  2. sql - If statement in select (ORACLE) - Stack Overflow

    So simple you can use case statement here. CASE WHEN ISSUE_DIVISION is null then "Null Value found" //give your option. Else 1 End. This will return 0 if both values are null which might not be what the OP expects / wants (see my comment on …

  3. sql - How to using select with if condition in oracle ... - Stack Overflow

    Sep 26, 2013 · My requirement is to get a number from a complex query and check if the num = desiredNum. If it is equal to desiredNum, then I must perform another set of select statements, Is there any way I can achieve this in a query rather than writing a function? Eg: Is this possible ??

  4. If Else with Select statement in Oracle sql developer

    Dec 3, 2015 · You can do switch-like statements with CASE expressions in plain SQL. See the following example : SELECT some_other_field, id, CASE ID WHEN A THEN columnA WHEN B THEN columnB ELSE 'Unknown' END genericvalue FROM customers;

  5. How to Execute an IF…THEN Logic in an SQL SELECT Statement

    Mar 26, 2025 · In this article, we explored different options for executing IF-THEN logic in a SQL SELECT statement. These options include using CASE, IIF(), and CHOOSE(). Furthermore, if we want a query that’s used in almost every dialect, we must choose the CASE statement.

  6. How to use a if statement within where clause? - Oracle Ask TOM

    Sep 12, 2005 · I want to use if statement within where clause. e.g select * from mytable m where col1 = {if col2 > sysdate then col2 else sysdate end if}

  7. How to Use If Else in SQL Select Statement - GeeksforGeeks

    Jan 2, 2025 · By using IF...ELSE within SQL statements we can categorize data, apply conditional transformations, and implement business logic directly in our queries. In this article, We will explain how to use IF...ELSE in SQL with detailed syntax …

  8. 14.38 IF Statement - Oracle Help Center

    The IF statement either runs or skips a sequence of one or more statements, depending on the value of a BOOLEAN expression. ( boolean_expression ::= , statement ::= ) Expression whose value is TRUE, FALSE, or NULL. The first boolean_expression is always evaluated.

  9. PL/SQL IF Statement - Oracle Tutorial

    This tutorial shows you how to use the PL/SQL IF statement to either execute or skip a sequence of statements based on a specified condition.

  10. Oracle / PLSQL: IF-THEN-ELSE Statement - TechOnTheNet

    This Oracle tutorial explains how to use the IF-THEN-ELSE statement in Oracle with syntax and examples. In Oracle, the IF-THEN-ELSE statement is used to execute code when a condition is TRUE, or execute different code if the condition evaluates to FALSE.

  11. Some results have been removed
Refresh