Opening Hours :7AM to 9PM
IF condition THEN S1; ELSE S2; END IF;In the above syntax 'if' condition is true the statements of 'if' block is execute.'if' the condition is false the statements of 'else' block is execute
DECLARE a number(2) := 10; BEGIN IF( a < 20 ) THEN dbms_output.put_line('a is less than 20' ); else dbms_output.put_line('a is not less than 20' ); END IF; END; /
DECLARE c_id customers.id%type := 1; c_sal customers.salary%type; BEGIN SELECT salary INTO c_sal FROM customers WHERE id = c_id; IF (c_sal <= 2000) THEN UPDATE customers SET salary = salary + 1000 WHERE id = c_id; dbms_output.put_line ('Salary 1000 updated'); else UPDATE customers SET salary = salary + 2000 WHERE id = c_id; dbms_output.put_line ('Salary 2000 updated'); END IF; END; /