A tale of Oracle SQL object types, their constructors, and how you use them. This demonstrates what you can and can’t do and gives brief explanations about why.
The following creates a base SAMPLE_OBJECT
data type
and a sample_table
collection of the base SAMPLE_OBJECT
data type.
CREATE OR REPLACE TYPE sample_object IS OBJECT (id NUMBER ,name VARCHAR2(30)); / CREATE OR REPLACE TYPE sample_table IS TABLE OF sample_object; /
If the base SAMPLE_OBJECT
data type were a Java
object, the default constructor of an empty call parameter list
would allow you to construct an instance variable. This doesn’t
work for an Oracle object type because the default constructor is
a formal parameter list of the object attributes in the
positional order of their appearance in the declaration
statement.
The test case on this concept is:
… |