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 :: sqlite update query python 
Sql :: how to update values in sql 
Sql :: sql left join with where clause 
Sql :: like query 
Sql :: sql limit to 5 results 
Sql :: creating sql table 
Sql :: open postgresql.conf in centos 
Sql :: select only distinct values another table 
Sql :: sqlalchemy case insensitive like 
Sql :: sql table 
Sql :: what is unique key in sql 
Sql :: first mysql 
Sql :: pl sql search saurce code 
Sql :: left join in sql oracle 
Sql :: get number of rows in every table mysql 
Sql :: postgresql find missing id 
Sql :: if role exists sql 
Sql :: Get a list of tables and the primary key 
Sql :: tsql generate rows 
Sql :: java sql connection close 
Sql :: oracle INTERVAL DAY to second to number 
Sql :: mysql inner join 
Sql :: how to connect sqlalchemy to mysql and deploy it 
Sql :: how to install sql server management studio in ubuntu 18.04 
Sql :: mysql workbench change default value 
Sql :: oracle job schedules 
Sql :: show broken table mysql 
Sql :: function plsql 
Sql :: update statement postgres 
Sql :: psql query execution time 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =