Oracle 8i Data Cartridge Developer's Guide Release 2 (8.1.6) Part Number A76937-01 |
|
Defining Object Types , 4 of 5
The system implicitly defines a constructor method for each object type that you define. The name of the constructor method is the same as the name of the object type. The parameters of the constructor method are exactly the data attributes of the object type, and they occur in the same order as the attribute definition for the object type. At present, only one constructor method can be defined, and thus you cannot define other constructor methods.
For example, when the system executes the following statement to create a type named rational_type, it also implicitly creates a constructor method for this object type.
CREATE TYPE rational_type ( numerator integer, denominator integer);
When you instantiate an object of rational_type, you invoke the constructor method. For example:
CREATE TABLE some_table ( c1 integer, c2 rational_type); INSERT INTO some_table VALUES (42, rational_type(223, 71));
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|