CREATE OR REPLACE TYPE MojTypBazowy AS OBJECT (Kolumna INTEGER) INSTANTIABLE NOT FINAL;
/
CREATE OR REPLACE TYPE MojTyp UNDER MojTypBazowy (Kolumna2 INTEGER);
/
CREATE TABLE MojaTabela OF MojTypBazowy;
INSERT INTO MojaTabela VALUES(MojTypBazowy(1));
INSERT INTO MojaTabela VALUES(MojTypBazowy(2));
INSERT INTO MojaTabela VALUES(MojTyp(1,2));
INSERT INTO MojaTabela VALUES(MojTyp(3,1));

SELECT * FROM MojaTabela;

SELECT VALUE(a) FROM MojaTabela a;

SELECT a.*,TREAT(VALUE(a) AS MojTyp).Kolumna2 FROM MojaTabela a;

SELECT VALUE(a) FROM MojaTabela a WHERE VALUE(a) IS OF TYPE (MojTyp);

SELECT VALUE(a) FROM MojaTabela a WHERE VALUE(a) IS OF TYPE (ONLY MojTypBazowy);
