Search
 
SCRIPT & CODE EXAMPLE
 

SQL

if else sql

IF Boolean_expression
BEGIN
    -- Statement block executes when the Boolean expression is TRUE
END
ELSE
BEGIN
    -- Statement block executes when the Boolean expression is FALSE
END
Comment

sql if else

DECLARE 
        a Number := 30;       b Number; 
BEGIN 
        IF a > 40 THEN 
          b := a - 40; 
          DBMS_OUTPUT.PUT_LINE('b=' || b); 
       elseif a = 30 then 
          b := a + 40; 
          DBMS_OUTPUT.PUT_LINE('b=' || b); 
       ELSE 
          b := 0; 
          DBMS_OUTPUT.PUT_LINE('b=' || b); 
       END IF; 
END; 
/
Comment

else if sql

UPDATE table 
SET columnB = CASE fieldA 
        WHEN columnA=1 THEN 'x' 
        WHEN columnA=2 THEN 'y' 
        ELSE 'z' 
      END 
WHERE columnC = 1
Comment

t-sql if else

IF 1=1
	SELECT 1
ELSE
	SELECT 0
-- returns 1

-- Definition
IF Boolean_expression   
     { sql_statement | statement_block }   
[ ELSE   
     { sql_statement | statement_block } ]
Comment

PREVIOUS NEXT
Code Example
Sql :: select only unique values from and to current table 
Sql :: insert data from one database table to another database table in postgresql using pgadmin 
Sql :: else if sql 
Sql :: wamp server mysql password 
Sql :: sql select data type of query 
Sql :: mysql error 1114 (hy000) the table is full 
Sql :: convert minutes to hours sql 
Sql :: how to find sql server installation folder 
Sql :: changing column names in sql query results 
Sql :: hibernate show sql xml property 
Sql :: sql float 3 decimal places 
Sql :: azure check access to sql database 
Sql :: alter session set nls_language french 
Sql :: what is drop in sql 
Sql :: oracle cast boolean to varchar2 
Sql :: Search In the Database using Text 
Sql :: tsql generate rows 
Sql :: oracle disk group space 
Sql :: check if user defined table type exists in sql server 
Sql :: mysql row generator 
Sql :: mysql delete duplicate rows except one 
Sql :: psql store procedure-return multiple table values 
Sql :: sql select inside select sub query 
Sql :: change column in mysql 
Sql :: how to get the previous day on mysql 
Sql :: What is SQL data store? 
Sql :: MySQL error code 2068 
Sql :: tsql cte in a transaction 
Sql :: sql xor 
Sql :: sql server download for windows 10 64 bit 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =