|PL/SQL User's Guide and Reference
Release 2 (9.2)
Part Number A96624-01
This section describes new features of PL/SQL release 9.0.1 and provides pointers to additional information.
The following sections describe the new features in PL/SQL:
You can now insert into or update a SQL table by specifying a PL/SQL record variable, rather than specifying each record attribute separately. You can also select entire rows into a PL/SQL table of records, rather than using a separate PL/SQL table for each SQL column.
You can create collections that are indexed by
VARCHAR2 values, providing features similar to hash tables in Perl and other languages.
You can now override the system default constructor for an object type with your own function.
UTL_FILE contains several new functions that let you perform general file-management operations from PL/SQL.
You can dynamically choose the level of type inheritance to use when calling object methods. That is, you can reference an object type that inherits from several levels of parent types, and call a method from a specific parent type. This function is similar to the SQL function of the same name.
Many of the cross-references from this book to other books have been made more specific, so that they link to a particular place within another book rather than to the table of contents. Because this is an ongoing project, not all links are improved in this edition. If you are reading a printed copy of this book, you can find the online equivalent at
http://tahiti.oracle.com/, with full search capability.
PL/SQL now supports the complete range of syntax for SQL statements, such as
DELETE, and so on. If you received errors for valid SQL syntax in PL/SQL programs before, those statements should now work.
Because of more consistent error-checking, you might find that some invalid code is now found at compile time instead of producing an error at runtime, or vice versa. You might need to change the source code as part of the migration procedure. See Oracle9i Database Migration for details on the complete migration procedure.
CASE statements and expressions are a shorthand way of representing IF/THEN choices with multiple alternatives.
Types can be declared in a supertype/subtype hierarchy, with subtypes inheriting attributes and methods from their supertypes. The subtypes can also add new attributes and methods, and override existing methods. A call to an object method executes the appropriate version of the method, based on the type of the object.
Attributes and methods can be added to and dropped from object types, without the need to re-create the types and corresponding data. This feature lets the type hierarchy adapt to changes in the application, rather than being planned out entirely in advance.
The new datatype
TIMESTAMP records time values including fractional seconds. New datatypes
TIMESTAMP WITH TIME ZONE and
TIMESTAMP WITH LOCAL TIME ZONE allow you to adjust date and time values to account for time zone differences. You can specify whether the time zone observes daylight savings time, to account for anomalies when clocks shift forward or backward. New datatypes
INTERVAL DAY TO SECOND and
INTERVAL YEAR TO MONTH represent differences between two date and time values, simplifying date arithmetic.
Improve performance by compiling Oracle-supplied and user-written stored procedures into native executables, using typical C development tools. This setting is saved so that the procedure is compiled the same way if it is later invalidated.
Data can be stored in Unicode format using fixed-width or variable-width character sets. String handling and storage declarations can be specified using byte lengths, or character lengths where the number of bytes is computed for you. You can set up the entire database to use the same length semantics for strings, or specify the settings for individual procedures; this setting is remembered if a procedure is invalidated.
You can query a set of returned rows like a table. Result sets can be passed from one function to another, letting you set up a sequence of transformations with no table to hold intermediate results. Rows of the result set can be returned a few at a time, reducing the memory overhead for producing large result sets within a function.
You can nest the collection types, for example to create a
VARRAY of PL/SQL tables, a
VARRAYs, or a PL/SQL table of PL/SQL tables. You can model complex data structures such as multidimensional arrays in a natural way.
You can operate on LOB types much like other similar types. You can use character functions on
NCLOB types. You can treat
BLOB types as
RAWs. Conversions between LOBs and other types are much simpler, particularly when converting from
LONG to LOB types.
You can now perform bulk SQL operations, such as bulk fetches, using native dynamic SQL (the
EXECUTE IMMEDIATE statement). You can perform bulk insert or update operations that continue despite errors on some rows, then examine the problems after the operation is complete.
This specialized statement combines insert and update into a single operation. It is intended for data warehousing applications that perform particular patterns of inserts and updates.