Types of Execution Flow Control Statements in Oracle

Q

What Are the Execution Control Statements in Oracle?

✍: FYIcenter.com

A

PL/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;
  <<;print>>
  DBMS_OUTPUT.PUT_LINE('Total counts: ' || TO_CHAR(total));
END;

This script should print this:

Total counts: 10
`

 

Use "IF" Statements with Multiple Conditions in Oracle

Convert Character Types to Numeric Types in Oracle

Understanding PL/SQL Language Basics

⇑⇑ Oracle Database Tutorials

2018-11-17, 1379🔥, 0💬