RelationalDBDesign RelationalDBDesign



Control Structures  «Prev  Next»
Lesson 7

PL/SQL Control Structures Conclusion

You can now add control structures to your PL/SQL block. In this module, you learned about conditional control statements such as IF-THEN, as well as iterative control statements such as LOOP and WHILE-LOOP. You also learned about the use of labels and the GOTO statement.
In this module, you learned how to:
  1. Build logic by using the IF-THEN-ELSE and ELSIF statements
  2. Determine how to begin and end a simple loop in a PL/SQL block
  3. Observe the structure of FOR and WHILE loops
  4. Define uses for labels and GOTO statements

Glossary terms

In this module, you were introduced to the following glossary terms:
  1. Block: A PL/SQL block is defined by the keywords DECLARE, BEGIN, EXCEPTION, and END, which break up the block into three sections:
    1. Declarative: statements that declare variables, constants, and other code elements, which can then be used within that block
    2. Executable: statements that are run when the block is executed
    3. Exception handling: a specially structured section you can use to catch, or trap, any exceptions that are raised when the executable section runs
  2. Control structures:
    1. The selection structure tests a condition, then executes one sequence of statements instead of another, depending on whether the condition is true or false.
    2. The iteration structure executes a sequence of statements repeatedly as long as a condition holds true.
  3. Loop:A LOOP statement executes a sequence of statements multiple times. PL/SQL provides these loop statements: 1) Basic loop 2) WHILE loop 3) FOR loop 4) Cursor FOR loop
  4. Subblock:A block within a block.
  5. Subprogram:A PL/SQL subprogram is a named PL/SQL block that can be invoked repeatedly. If the subprogram has parameters, their values can differ for each invocation. A subprogram is either a procedure or a function. Typically, you use a procedure to perform an action and a function to compute and return a value.

Pl/SQL Control Structures - Quiz

Click the Quiz link below to take a multiple-choice quiz about the material we covered in this module.
PL/SQL Control Structures - Quiz