So I have the following user defined type in my oracle database:
CREATE OR REPLACE TYPE METRIC_IMPERIAL_DISTANCE AS OBJECT ( METERS_FEET INTEGER, CENTIMETERS_INCHES INTEGER, FRACTION NUMBER )
I can do the following:
SELECT t_id, get_distance_breakdown (h.height, h.unit_of_measure_id) height_breakdown FROM heights h
and even
SELECT t_id, get_distance_breakdown (h.height, h.unit_of_measure_id).meters_feet height_meters_feet FROM heights h
but the following fails with a ORA-00904: ‘HEIGHT_BREAKDOWN’.’METERS_FEET’: invalid identifier error:
SELECT t_id, height_breakdown.meters_feet FROM (SELECT t_id, get_distance_breakdown (h.height, h.unit_of_measure_id) height_breakdown FROM heights h);
What gives? If there isn’t some simple and obvious work-around for this then that decimates much of what would be useful about oracle’s user defined types. I feel like I must be missing something.
I believe Oracle needs an alias for the in-line view: