TEC 5323 Advanced Database Technology


Discussion of Week 8

This week's discussion focus on PL/SQL control structure, which is a major advances from SQL.

 

Discussion Topics:

1. There are three types of major loop controls in PL/SQL including BASIC loop (Exercise 5.3, example 1, page 106), WHILE loop (Exercise 5.3, example 2, page 107) and FOR loop (Exercise 5.3, example 3, page 107).

2. Conditional control (IF...ELSIF...ELSE). Please note the word ELSIF does not have "E" in it. This is the only non-English-conforming syntax I knew in Oracle.

 

 

Questions:

1. How many times at least the BASIC loop and WHILE loop will execute? Why?

2. The following is a PL/SQL block (a question from Oracle OCP exam):

BEGIN
FOR i IN 1..6 LOOP
IF i=2 OR i=3 THEN
null;
ELSE
INSERT INTO example(one)
VALUES (i);
END IF;
ROLLBACK;
END LOOP;
COMMIT;
END;
How many values will be inserted into the EXAMPLE table? Why?

When you are ready, please click Discussion Board to login.

Class Index

School of Technology
College of Business & Applied Sciences
Eastern Illinois University