Opening Hours :7AM to 9PM
if(Condition) then ... ... ... end if;In the above syntax 'if' condition is true the statements of 'if' block is execute.'if' the condition is false program terminated.
DECLARE a number(2) := 10; BEGIN IF( a < 20 ) THEN dbms_output.put_line('a is less than 20' ); END IF; dbms_output.put_line('value of a is : ' || a); 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 updated'); END IF; END; /