Reputation: 14731
When creating a type of object, is it possible to declare the type as TABLE.COLUMNNAME%TYPE
?
e.g.
CREATE OR REPLACE TYPE PROJECT_TYPE IS OBJECT
(
project_id project.project_id%TYPE,
project_desc project.project_desc%TYPE
);
or I have to specify the type and width at the time of creation? Reason why this question is if table is altered then I have to change to data type and width of type OBJECT as well?
Upvotes: 0
Views: 150
Reputation: 8113
It is, unfortunately, not possible. You have to provide actual type, you can not reference a %TYPE
of a table's column.
The reason for that is that both %TYPE
and %ROWTYPE
are PL/SQL constructs, which are not supported in SQL.
Upvotes: 1