- Shopping Bag ( 0 items )
Devoted entirely to the PL/SQL (Procedural Language extension to SQL), this second edition of Oracle PL/SQL Programming updates the first edition for Oracle8, and includes chapters on new PL/SQL object features (object types, collections, object views, and external procedures). The first three chapters of the book explain what it means to program in PL/SQL, and then walk you through the main features of the language, programming habits, and effective coding style. It then moves on to basic PL/SQL programming components such as variables, cursors, conditional and sequential control statements, loops, exception handlers, PL/SQL records, and PL/SQL tables. Part three of the book covers built-in functions such as character, date, numeric, LOB, and conversion functions that can be put to use immediately in your applications. Moving forward, you will learn how to build procedures, functions, and packages correctly. Chapters 18 through 21 give an in-depth coverage of the new features of Oracle8. Learn about object types, nested tables and VARRAYs, object views, and external procedures. Armed with a summary of helpful tips for effective PL/SQL programming in the real world, part six of the book shows you how to manage your PL/SQL code and debug, tune, and trace the execution of your programs. The text contains numerous examples to guide you as to how, when, and where to apply programming constructs most effectively. Appendices A through C contain a summary of contents on the companion disk, how to call stored procedures from PL/SQL Version 1.1, and how to call Oracle's built-in packages.
...The LONG datatype
A variable declared LONG can store variable-length strings of up to 32760 bytes--this is actually seven fewer bytes than allowed in VARCHAR2 type variables! The LONG datatype for PL/SQL variables is quite different from the LONG datatype for columns in the Oracle Server. The LONG datatype in Oracle7 can store character strings of up to two gigabytes or 231-1 bytes; this large size makes the LONG column a possible repository of mulitmedia information, such as graphics images.
As a result of these maximum length differences, you can always insert a PL/SQL LONG variable value into a LONG database column, but you cannot select a LONG database value larger than 32760 bytes into a PL/SQL LONG variable.
In the Oracle database, there are many restrictions on how the LONG column can be used in a SQL statement; for example:
Given the fact that aVARCHAR2 variable actually has a higher maximum length than the LONG and has no restrictions attached to it, I recommend that you always use the VARCHAR2 datatype in PL/SQL programs. LONGs have a place in the RDBMS, but that role is not duplicated in PL/SQL. This makes some sense since you will very rarely want to manipulate truly enormous strings within your program using such functions as SUBSTR or LENGTH or INSTR.
The RAW datatype
The RAW datatype is used to store binary data or other kinds of raw data, such as a digitized picture or image. A RAW variable has the same maximum length as VARCHAR2 (32767 bytes), which must also be specified when the variable is declared. The difference between RAW and VARCHAR2 is that PL/SQL will not try to interpret raw data. Within the Oracle RDBMS this means that Oracle will not perform character set conversions on RAW data when it is moved from one system (based, for example, on 7-bit ASCII) to another system.
Once again, there is an inconsistency between the PL/SQL maximum length for a RAW variable (32767) and the RDBMS maximum length (255). As a result, you cannot insert more than 255 bytes of your PL/SQL RAW variable's value into a database column. You can, on the other hand, insert the full value of a PL/SQL RAW variable into a column with type LONG RAW, which is a two-gigabyte container for raw data in the database.
The LONG RAW datatype
The LONG RAW datatype stores raw data of up to 32760 bytes and is just like the LONG datatype excerpt that the data in a LONG RAW variable is not interpreted by PL/SQL.
Given the fact that a RAW variable actually has a higher maximum length than the LONG RAW and has no restrictions attached to it, I recommended that you always use the RAW datatype in PL/SQL programs. LONG RAWs have a place in the RDBMS, but that role is not duplicated in PL/SQL.
The ROWID datatype
In the Oracle RDBMS, ROWID is a pseudocolumn that is part of every table you create. the rowid is an internally generated and maintained binary value which identifies a row of data in your table. It is called a pseudocolumn because a SQL statement includes it in places where you would normally use a column. However, it is not a column that you create for the table. Instead, the RDBMS generates the rowid for each row as it is inserted into the database. The information in the rowid provides the exact physical location of the row in the database. You cannot change the value of a rowid.
You can use the ROWID datatype to store rowids from the database in your PL/SQL program. You can SELECT or FETCH the rowid for a row into a ROWID variable. To manipulate rowids in Oracle8, you will want to use the built-in package, DBMS_ROWID (see Appendix C, Built-In Packages). In Oracle7, you will use the ROWIDTOCHAR function to convert the rowid to a fixed-length string and then perform operations against that string.
In Oracle7, for format of the fixed-length rowid is as follows:
Components of this format have the following meanings:
The block in the database file
The row in the clock (where the first row is zero, not one)
The database file
All these numbers are hexadecimal; the database file is a number which you would then use to look up the actual name of the database file through the data dictionary.
In Oracle8, rowid have been "extended" to support partitioned tables and indexes. The new, extended rowids include a data object number, identifying the database segment. Any schema object found in the same segment, such as a cluster of tables, will have the same object number. In Oracle8, then, a rowid contains the following information:
|1||Introduction to PL/SQL||3|
|2||PL/SQL Language Fundamentals||33|
|3||Effective Coding Style||47|
|4||Variables and Program Data||83|
|5||Conditional and Sequential Control||131|
|9||Records in PL/SQL||265|
|13||Numeric and Miscellaneous Functions||401|
|16||Procedures and Functions||559|
|19||Stored PL/SQL Functions in SQL||745|
|20||Code Design Tips||773|
|21||Managing Code in the Database||819|
|App. A: What's on the Companion Disk?||855|
|App. B: Calling Stored Procedures from PL/SQL Version 1.1||861|
Posted January 5, 2014
Posted March 18, 2006
Are you an application developer or database administrator? Well, you're in luck! Authors Steven Feuerstein and Bill Pribyl, have done an outstanding job of writing a 4th edition of a book that provides comprehensive useful coverage of the PL/SQL language. Feuerstein and Pribyl, begin with an introduction to the PL/SQL language. Then, they show you how to get PL/SQL programs up and running as quickly as possible. The authors continue by reviewing the fundamentals of the PL/SQL language: what makes a PL/SQL statement, an introduction to the block structure, and how to write comments in PL/SQL. They also explore conditional and sequential control statements, loops, and exception handling in the PL/SQL language. They continue by looking at various types of program data you can define in PL/SQL, such as numbers, strings, records, and collections. In addition, the authors next address one of the most central elements of PL/SQL code construction: the connection to the underlying database, which takes place through the SQL language. They also show you the building blocks of applications, which include procedures, functions, triggers, and packages, and how to move information into and out of PL/SQL programs. Then, the authors explore the security-related challenges you face as you build PL/SQL programs. They continue by exploring the inside of PL/SQL, including PL/SQL's use of memory. In addition, the authors provide guidance for PL/SQL developers who need to address issues of globalization and localization. They also provide an in-depth guide to the object-oriented features of Oracle. Finally, they show you how to invoke Java and C code from your PL/SQL applications. If you are new to PL/SQL, reading this excellent book from beginning to end should improve your PL/SQL skills and deepen your understanding of the language. Needless to say, if you're already a proficient PL/SQL programmer, you'll probably want to dip into the appropriate sections of this book to extract particular techniques for immediate application.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted January 21, 2009
No text was provided for this review.
Posted October 19, 2011
No text was provided for this review.