A PL/SQL program is made up of a series of statements. A statement is terminated with a semicolon ( ; ), not with the physical end of a line. In fact, a single statement is often spread over several lines to make it more readable. The following IF statement takes up four lines and is indented to reinforce the logic behind the statement:
IF salary < min_salary (1994) THEN salary := salary + salary*.25; END IF;
There are two semicolons in this IF statement. The first semicolon indicates the end of the single executable statement within the IF-END IF construct. The second semicolon terminates the IF statement itself. This same statement could also be placed on a single physical line (if it would fit):
IF salary < min_salary (1994) THEN salary := salary + salary*.25; END IF;
The semicolons are still needed to terminate the logical, executable statements. I suggest that you do not, however, combine the different components of the IF statement on a single line. It is much more difficult to read. I also recommend that you never place more than one executable (or declaration) statement on each line. Compare the following statements:
DECLARE continue_scanning BOOLEAN := TRUE; scan_index NUMBER := 1;
and:
DECLARE continue_scanning BOOLEAN := TRUE; scan_index NUMBER := 1;
In the second example, the two different statements blur into a single stream of text. It is difficult to find the semicolon in the middle of a line.
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.