/*实现Oracle面向对象思想*/
/*创建基类型规范*/
create or replace type ty_test
is object
(
x number,
member procedure pro_test
)
not final;
/*创建基类型主题*/
create or replace type body ty_test
is
member procedure pro_test
is
begin
dbms_output.put_line('aaa');
end pro_test;
end;
/*创建子类型规范子类型实现对基类型的重写*/
create or replace type ty_son under ty_test
(
y number,
overriding member procedure pro_test
)
/*创建子类型的主体*/
create or replace type body ty_son
is
overriding member procedure pro_test
is
begin
dbms_output.put_line('bbb');
end pro_test;
end;
/*调用类型*/
declare
ty ty_test;
begin
ty:=ty_son(5,8);
ty.pro_test;
end;