下面是schema:
CREATE OR REPLACE TYPE Component_ty AS OBJECT (
Code VARCHAR(10),
Component_Description VARCHAR(100),
Component_Type VARCHAR(10))
NOT FINAL;
CREATE OR REPLACE TYPE External_Component_ty UNDER Component_ty(
External_Company REF External_Company_ty);
CREATE OR REPLACE TYPE component_ty_nt AS TABLE OF REF component_ty;
CREATE TABLE Component OF component_ty(
Code PRIMARY KEY,
Component_Description NOT NULL,
Component_Type NOT NULL,
CONSTRAINT component_type__chk
CHECK (component_type IN ('body', 'Body', 'engine', 'Engine', 'equipment', 'Equipment'))
);
CREATE TABLE MODEL (
model_name VARCHAR(20),
model_year NUMBER,
consumption VARCHAR(6) NOT NULL,
Component component_ty_nt,
Distributor distributor_ty_nt,
Car car_ty_nt,
CONSTRAINT t_pk PRIMARY KEY (Model_Name, Model_Year))
NESTED TABLE Component STORE AS component_ty_nt_TAB
NESTED TABLE Distributor STORE AS distributor_ty_nt_TAB
NESTED TABLE Car STORE AS car_ty_nt_TAB
如何检索external_component中external_company值为null的模型的信息?
1条答案
按热度按时间guykilcj1#
您可以使用以下命令检查嵌套表中的值是否具有正确的类型,并且具有
NULL
值:举个最小的例子:
输出:
| 型号名称|型号_年份|代码|
| --------------|--------------|--------------|
| B|1|B|
| E|1|B|
| F|1|B|
fiddle