||Oracle Tips by Burleson
Oracle 10g Representing Dynamically Typed Data Using
SYS.AnyData, SYS.AnyType, and SYS.AnyDataSet Types
There are features in some languages that allow
datatypes to change at runtime, and there are functions that let a
program check the type of a variable. For example, Java has the
typeof operator and wrapper types such as Number, and C has the
union keyword and the void * pointer.
Oracle9i and Oracle Database 10g include
features that let you create variables and columns that can hold any
type of data, and allow you to test such data values to see their
underlying representation. Using these features, a single table
column can represent different data types, depending on the row in
which it resides.
The SYS.ANYDATA Oracle built-in type can
represent any scalar or object value. The SYS.ANYDATA type has
methods to bring in scalar (single) values of any type, and to
convert the value back into a scalar or object.
In addition to the scalar SYS.ANYDATA, the
built-in type SYS.ANYDATASET can be used to represent values of any
Oracle collection type.
In conjunction with the SYS.ANYDATA and
SYS.ANYDATASET types, you can use the SYS.ANYTYPE and dbms_types
package to manipulate and check type information.
same functionality is available through the OCI interface, using the
OCIType, OCIAnyData, and OCIAnyDataSet interfaces.
Get the complete story:
To get the code instantly, click here:
Need an Oracle Mentor?
BEI is now offering personal mentors for Oracle DBAs where you can have an
Oracle expert right at your fingertips, anytime day or night. We work with
hundreds of Oracle databases every year, so we know exactly how to quickly
assist you with any Oracle question.
Why risk an unplanned outage? You can now get telephone access to Don
Burleson or any of his Oracle Certified DBAs with more than 20 years of
full-time IT experience. Click here for details: