Jonathan Gennick

Jonathan Gennick

press my name for the menu

Writer * Book Editor * Oracle DBA * SQL & PL/SQL Developer

Father * Husband * Son * Mountain Biker * EMT

Teach Yourself PL/SQL in 21 Days
Frequently Asked Questions

Where can I get the data for the examples in chapter 2?
Unfortunately, the data for the examples in chapter 2 did not make it onto the CD accompanying the book. This ommission made it past all three authors, the technical editor, and the development editor, and I sincerely apologize for this.

The original data is no longer available. However, I have reconstructed the data based on the listings and output in the book. The result is in ch2_data.zip, which contains scripts to create and populate tables for chapter 2. This will let you run the listings shown in the chapter.

Where are the scripts to create the sample tables?
The sample tables are created in chapter 9, and are used throughout the remainder of the book. The scripts for creating these tables are included on the CD, in the \SOURCE\DAY09 directory. Look for these three files: TYP9_1.TXT, TYP9_2.TXT, TYP9_3.TXT.

Why can't I execute listing 3.7 on page 59?
This was never intended to be executed. I was talking about the different PL/SQL blocks, and wanted to show one of each type. Since the book didn't have you create any tables until chapter 9, I couldn't include one that worked in any chapter prior to that. Triggers are covered thoroughly in chapter 11.

On page 189, I don't understand the section on arguments. Would you clarify it?
This part of the book isn't written too clearly. Arguments to a PL/SQL procedure may be one of three types: in, out, or inout. Arguments of type IN may only be used to pass data into the procedure. If you try to code a procedure to assign a value to an IN argument, you will receive an error. The following, for example, will not work because it tries to assign a value to an IN argument:

                procedure test (my_arg IN NUMBER) IS
                begin
                  my_arg:=5;
                end;
                /

The OUT argument, on the other hand, is used to define arguments that are output only. It's the reverse of IN, and is used when you need to pass a value back from the procedure. The following code will not compile because it tries to read a value from an OUT argument:

                procedure test (my_arg OUT NUMBER) IS
                declare
                  x number;
                begin
                  x := my_arg;
                end;
                /

The INOUT argument is used to define arguments that may be used both ways, allowing you to pass a value into a procedure, modify it, and return a new value it its place.

To what database table does listing 8.1 refer?
Listing 8.1 refers to a table named JOURNAL. This is just an example that the author of chapter 8 put together, and the JOURNAL table is not defined anywhere in the book. I realize that this listing may be confusing because you have not seen the JOURNAL table defined anywhere, but the important point here is to understand the syntax used for creating a procedure. That's what listing 8.1 is trying to demonstrate.

Why won't listing 13.5 work?
Oracle made a slight change between the beta and production releases of Oracle8. When using dot notation to select an attribute of an object from a table containing an object column, Oracle made it a requirement that you supply an alias for that table in your SELECT statement. Oracle further requires you to use that alias to qualify the column name in your select statement. With reference to listing 13.5, and assuming an alias of e for the employee table, you need to reference the home phone number as e.home_address.phone_number.

Why does Oracle require table aliases to qualify references to object attributes?
It's done to avoid the potential problem of inner capture. Chapter 15 of the Oracle8 Concepts manual contains a good explanation of this issue. Look under the subheading of References and Name Resolution.

Page 361 refers to a directory on the CD named "books", which I can't find. Where is it?
Somehow, that directory never made it onto the CD. If you want to run the examples in the chapter, and you need some files, download books.zip. Place the files that it contains in a directory named books on your hard drive. Note that the listings in the book expect the directory to be c:\books.