如何显示对象中的数据

时间:2019-06-18 20:56:01

标签: oracle plsql

当我使用SELECT来显示表时,在ID和Subject列中显示内容,而在date列中仅显示SYSTEM.DATAS

create or replace type dataS as object
(
    city VARCHAR2(20),
    year NUMBER,
    publishing VARCHAR2(40),
    constructor function dataS (city number, year number,
    publishing varchar2) return self as result,
    member procedure print  
);

create or replace type body dataS
is
    constructor function dataS (city number, year number,
    publishing varchar2) return self as result
        is
        begin
        self.city := city;
        self.year := year;
        self.publishing := publishing;
        return;
    end;
    member procedure print
    is
    begin
        dbms_output.put_line( self.city || ',' || self.year || ',' || self.publishing);
    end;
end;
create or replace type book as object
(
    idBook number,
    subject VARCHAR2(20),
    data dataS,
    constructor function book (idBook number, subject varchar2, data dataS) return self as result,
    member procedure print
);
create or replace type body book
is
    constructor function book (idBook number, subject varchar2, data dataS)
  return self as result
        is
        begin
        self.idBook := idBook;
        self.subject := subject;
        self.data := data;

        return;
    end;
    member procedure print
    is 
    begin
        dbms_output.put_line(self.idBook || ',' || self.subject);
        self.datadane.print();
    end;
end;
create table books of book
(
    idBooks not null,
    subject not null,

    constraint ck_publishing check (data.wpublishing is not null),
    constraint pk_books primary key (idBooks),
    constraint u_year unique(data.year)
);
INSERT INTO books VALUES (1, 'Thiller', 
(dataS('Tokyo', 1994,'XXX')));

如何在日期栏中显示年份,出版和城市?

0 个答案:

没有答案