If and elsif

PHOTO EMBED

Thu Sep 23 2021 02:01:51 GMT+0000 (UTC)

Saved by @kaveen

--example 1
DECLARE
id number(10) := 5;
BEGIN 
	IF id = 5 THEN
    	dbms_output.put_line('Value is 5');
	END IF;

END;


--example 2
DECLARE
	id number(10) := 5;
BEGIN
	IF id = 1 THEN
    	dbms_output.put_line('Value is 1');
	elsif id = 5 THEN
    	dbms_output.put_line('Value is 5');
	end if;

END;

--example 3
DECLARE
	id number(10) := 5;
BEGIN
	IF id = 1 THEN
    	dbms_output.put_line('Value is 1');
	elsif id = 5 THEN
    	dbms_output.put_line('Value is 5');
	else
      dbms_output.put_line('Value not found');
	end if;

END;
content_copyCOPY