This is the errata for the Oracle Database 11g PL/SQL Programming Workbook. While you try to eliminate all errors when you write a book and I think we did a great job on this book because the errors are minimal. However, re-reading our own book and taking input from those who also read it, we find things missed or opportunities to improve clarity. This errata includes corrections of mistakes, suggestions for change, and improvements to the base text. If the book is successful, I’m sure they’ll make it into the next edition.
If you’re reading or read the book, please feel free to let me know of any uncaught error or suggestion that you may have. Thanks, Michael
(Acknowledgment and corrections to Oracle Database 11g PL/SQL Programming Workbook)
The Guard Exit Loop drawing should have the exit from the decision diamond not the Iterative Step rectangle. The corrected Figure 2-2 should look like this:
The anonymous block is missing the declaration of the
stmt variable, which can be a
CLOB based on the physical size of the sample function being wrapped. It’s a best practice to use a
CLOB data type, and below is the complete working program unit.
SQL> DECLARE 2 stmt CLOB; 3 SOURCE DBMS_SQL.VARCHAR2S; 4 SOURCE DBMS_SQL.VARCHAR2S; 5 BEGIN 6 SOURCE(1) := 'CREATE FUNCTION two RETURN NUMBER IS '; 7 SOURCE(2) := ' BEGIN '; 8 SOURCE(3) := ' RETURN 2; '; 9 SOURCE(4) := ' END;'; 10 RESULT := DBMS_DDL.WRAP(ddl => SOURCE, lb => 1, up => SOURCE.COUNT); 11 FOR i IN 1..result.COUNT LOOP 12 stmt := stmt || RESULT(i); 13 END LOOP; 14 EXECUTE IMMEDIATE stmt; 15 END; 16 /