Basic Oracle Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
What Are the Execution Control Statements in Oracle?
Answer:
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;
<>
DBMS_OUTPUT.PUT_LINE('Total counts: ' || TO_CHAR(total));
END;
This script should print this:
Total counts: 10
► 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
Download Oracle Database Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Convert Character Types to Numeric Types? | How To Use "IF" Statements on Multiple Conditions? |