0% found this document useful (0 votes)
6 views1 page

Control Structures in PL/SQL

The document discusses control structures in PL/SQL, categorizing them into conditional, iterative, and sequential controls. It focuses on the conditional control using the IF-THEN-ELSEIF statement, providing syntax and an example for its implementation. The example illustrates how to execute different actions based on specified conditions.

Uploaded by

patelsoham.797
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Control Structures in PL/SQL

The document discusses control structures in PL/SQL, categorizing them into conditional, iterative, and sequential controls. It focuses on the conditional control using the IF-THEN-ELSEIF statement, providing syntax and an example for its implementation. The example illustrates how to execute different actions based on specified conditions.

Uploaded by

patelsoham.797
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unit-3 (Stored procedures and User defined functions)

 Control structures
 The flow of control statements can be classified into the following categories:
 Conditional Control
 Iterative Control
 Sequential Control
 Conditional Control
 PL/SQL allows the use of an IF statement to control the execution of a block of code.
 In PL/SQL, the IF -THEN - ELSIF - ELSE - END IF construct in code blocks allow specifying
certain conditions under which a specific block of code should be executed.
 Syntax:
IF < Condition > THEN
< Action >
ELSIF <Condition> THEN
< Action >
ELSE
< Action >
END IF;
 Example Using the IF-THEN-ELSEIF Statement
DECLARE
a Number := 30;
b Number;
BEGIN
IF a > 40 THEN
b := a - 40;
DBMS_OUTPUT.PUT_LINE('b=' || b);
elsif a = 30 then
b := a + 40;
DBMS_OUTPUT.PUT_LINE('b=' || b);
ELSE
b := 0;
DBMS_OUTPUT.PUT_LINE('b=' || b);
END IF;
END;
/

You might also like