What Are the Execution Control Statements in Oracle?
Submitted by: AdministratorPL/SQL supports three groups of execution control statements:
► IF Statements - Conditionally executes a block of statements.
► CASE Statements - Selectively executes a block of statements.
► LOOP Statements - Repeatedly executes a block of statements.
► GOTO Statements - Unconditional changes the execution flow to a specified statement.
The script below shows some execution control statements:
DECLARE
total NUMBER;
BEGIN
total := 0;
LOOP
total := total+1;
IF total >= 10 THEN
GOTO print;
END IF;
END LOOP;
<>
DBMS_OUTPUT.PUT_LINE('Total counts: ' || TO_CHAR(total));
END;
This script should print this:
Total counts: 10
Submitted by: Administrator
► IF Statements - Conditionally executes a block of statements.
► CASE Statements - Selectively executes a block of statements.
► LOOP Statements - Repeatedly executes a block of statements.
► GOTO Statements - Unconditional changes the execution flow to a specified statement.
The script below shows some execution control statements:
DECLARE
total NUMBER;
BEGIN
total := 0;
LOOP
total := total+1;
IF total >= 10 THEN
GOTO print;
END IF;
END LOOP;
<>
DBMS_OUTPUT.PUT_LINE('Total counts: ' || TO_CHAR(total));
END;
This script should print this:
Total counts: 10
Submitted by: Administrator
Read Online Oracle Database Job Interview Questions And Answers
Top Oracle Database Questions
☺ | How To Use "OUT" Parameter Properly? |
☺ | How Run SQL*Plus Commands That Are Stored in a Local File? |
☺ | How To Create a Stored Procedure in Oracle? |
☺ | What Is the Relation of a User Account and a Schema? |
☺ | What Happens to Indexes If You Drop a Table? |
Top DB Oracle Categories
☺ | Oracle PL-SQL Interview Questions. |
☺ | Oracle DBA Interview Questions. |
☺ | Oracle D2K Interview Questions. |
☺ | OCI Interview Questions. |
☺ | Oracle RMAN Interview Questions. |