【发布时间】:2014-10-25 05:46:44
【问题描述】:
我正在尝试为我的类型components_t 创建一个类型主体。这是该类型的代码:
create type components_t under product_t (compPrice number(5,2),
compDesc varchar(15), compYear number(4),
member function changeDesc return varchar);
/
这是我目前拥有的类型主体的代码:
create type body components_t as member function changeDesc
return varchar
is
begin
if self.compYear < 2005 then
return self.compDesc||' Discontinued';
end if;
end;
/
我试图对类型主体做的是,如果组件的年份小于 2005 年,则将 ' Discontinued' 连接到描述的末尾。我试过输入这个并得到这个错误:
SQL> show errors
Errors for TYPE BODY COMPONENTS_T:
LINE/COL ERROR
-------- -----------------------------------------------------------------
8/4 PLS-00103: Encountered the symbol "end-of-file" when expecting
one of the following:
end not pragma final instantiable order overriding static
member constructor map
首先,我想知道这在 PL/SQL 中是否可行。其次,有谁知道我可以做些什么来使语法正确吗?
【问题讨论】: