tailieunhanh - Teach Yourself PL/SQL in 21 Days- P4

Teach Yourself PL/SQL in 21 Days- P4: Welcome to Sams Teach Yourself PL/SQL in 21 Days, Second Edition. The fact that you purchased this book indicates that you have an interest in learning the PL/SQL language, which is Oracle’s relational database procedural programming language. It allows you to develop powerful and complex programs to access and manipulate data in the Oracle8i database. We have attempted to include as many examples of PL/SQL code as possible to illustrate PL/SQL features | Week 1 Day 5 Implementing Loops and GOTOs by Tom Luers Day 4 Using Functions IF Statements and Loops demonstrates ways to change the order of execution with PL SQL. Today s lesson covers several additional methods of changing the order of execution. Today s material covers the following topics Statement labels The GOTO statement The WHILE loop The simple LOOP Emulating a loop Recursion 128 Day 5 Exploring Labels and the GOTO Statement The GOTO statement allows for unconditional branching to a statement label. You will first learn about statement labels which are necessary to include before you can even use the GOTO statement. Statement Labels Statement labels are identifiers of a block of code that is similar to a function but they are not actual PL SQL statements. The GOTO statement can directly access these labels. In addition these labels can be accessed by loops which are covered in the section The EXIT and EXIT WHEN Statements. The format of a label is label_name Notice two things about the label The label is surrounded by double brackets . The label must not have a semicolon after the label name. The label name does not contain a semicolon because it is not a PL SQL statement but rather an identifier of a block of PL SQL code. Caution Labels can t take the place of required statements therefore you must have at least one statement after the label or an error results. If your intention is to execute the code after a label you should re-evaluate your code decisions and choose an alternate method such as a function. Syntax The GOTO Statement The GOTO statement enables you to immediately transfer control to another labeled PL SQL block without the need for conditional checking. As soon as the GOTO statement is encountered all control is transferred to the code following the matching label_name. This target label can appear anywhere in the same block of code. The Syntax for the goto Statement GOTO label_name The label_name is the matching label_name .

TÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN