So I have the following user defined type in my oracle database:
所以我的oracle数据库中有以下用户定义的类型:
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:
但是下面的ORA-00904失败了:“HEIGHT_BREAKDOWN”。“METERS_FEET”:标识符无效错误:
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.
是什么赋予了?如果没有一些简单而明显的解决办法,那么就会大量抽取oracle用户定义类型的大部分内容。我觉得我必须遗漏一些东西。
1 个解决方案
#1
3
I believe Oracle needs an alias for the in-line view:
我相信Oracle需要内联视图的别名:
SELECT v.t_id, v.height_breakdown.meters_feet
FROM (SELECT t_id, get_distance_breakdown (h.height, h.unit_of_measure_id) height_breakdown
FROM heights h) v;
#1
3
I believe Oracle needs an alias for the in-line view:
我相信Oracle需要内联视图的别名:
SELECT v.t_id, v.height_breakdown.meters_feet
FROM (SELECT t_id, get_distance_breakdown (h.height, h.unit_of_measure_id) height_breakdown
FROM heights h) v;