我對如何打印定義類型的對象的所有值有疑問。我有一個PROJECTT類型的對象表SP。當我在SP中查詢其對象的行時,它將返回對象的類型(PROJECTT),但不返回對象的內容。 PROJECTT類型有5個varchar列,這是我想要返回的。從一列嵌套表中選擇SQL
下面是我的SQL我的表,然後使用Java SAX解析器和XML文件類型
set echo on
set serveroutput on
drop table ACTIVES;
drop table POBJECT;
drop type ACTIVEST;
drop type POBJECTT;
create type POBJECTT as
object (p# varchar(5), pname varchar(20), color varchar(10),
weight number, city varchar(10));
create table POBJECT of POBJECTT;
insert into POBJECT(p#, pname, color, weight, city) values
('P1', 'Nut', 'Red', 12, 'London');
insert into POBJECT(p#, pname, color, weight, city) values
('P2', 'Bolt', 'Green', 17, 'Paris');
insert into POBJECT(p#, pname, color, weight, city) values
('P3', 'Screw', 'Blue', 17, 'Rome');
insert into POBJECT(p#, pname, color, weight, city) values
('P4', 'Screw', 'Red', 14, 'London');
insert into POBJECT(p#, pname, color, weight, city) values
('P5', 'Cam', 'Blue', 12, 'Paris');
insert into POBJECT(p#, pname, color, weight, city) values
('P6', 'Cog', 'Red', 19, 'London');
create type ACTIVEST as table of ref POBJECTT;
/
create table ACTIVES(s# varchar(5), sname varchar(20), status number,
city varchar(10), sp ACTIVEST)
,我填的活性成分的SP柱在POBJECTS表中的行引用。
我想用select語句打印這些行。我不太清楚如何讓SP的目標的價值,所以我就開始喜歡的東西:
select * from (select sp from actives where S# = 'S1')
請發佈您的表和類型的CREATE語句以及您的查詢的SQL。 – 2012-04-20 16:56:08
+1用於補充問題@BobJarvis評論 – Matthew 2012-04-20 19:27:46
更新了更多信息! :) – Teknos 2012-04-20 20:48:34