创建UDT函数时PLS-00539和PLS-00538错误

时间:2017-11-01 03:19:11

标签: oracle plsql user-defined-types

我正在尝试使用Oracle创建一个包含类型的类型层次结构,但在创建其函数时我收到错误PLS-00539和PLS-00538。

我用来创建类型的代码是:

CREATE OR REPLACE TYPE VC_MNumber AS Object (   
  idno NUMBER,
  MEMBER FUNCTION  dimension   RETURN NUMBER ,
  MEMBER FUNCTION typeName RETURN VARCHAR2) NOT INSTANTIABLE NOT FINAL;
/

DROP TYPE VC_MINTEGER;

CREATE OR REPLACE TYPE VC_MInteger UNDER VC_MNumber (   
  OVERRIDING MEMBER FUNCTION  dimension   RETURN NUMBER ,
  OVERRIDING MEMBER FUNCTION typeName RETURN VARCHAR2);
/

CREATE OR REPLACE TYPE VC_MReal UNDER VC_MNumber(   
  YDCCoeff NUMBER,
  CbDCCoeff NUMBER,
  CrDCCoeff NUMBER,
  OVERRIDING MEMBER FUNCTION  typeDimension   RETURN NUMBER, 
  OVERRIDING MEMBER FUNCTION typeName RETURN VARCHAR2) FINAL;
/

到目前为止一切都还可以,但是当我尝试创建函数时:

CREATE OR REPLACE TYPE BODY VC_MReal AS
  OVERRIDING MEMBER FUNCTION typeDimension RETURN NUMBER IS
    var_dimension       number :=  10;
    BEGIN
        RETURN var_dimension;
    END;
   MEMBER FUNCTION typeName RETURN VARCHAR2 IS
    var_typeName        VARCHAR2(400) :=  'VC_MREAL';
    BEGIN
        RETURN var_typeName;
    END;
END;
/

我收到错误PLS-00539和PLS-00538。我不知道我做错了什么。我很感激这一点。错误在哪里?

1 个答案:

答案 0 :(得分:1)

  

PLS-00538:子程序或游标'TYPENAME'在对象中声明   类型规范,必须在对象类型体中定义   PLS-00539:子程序'TYPENAME'在对象类型主体中声明   并且必须在对象类型规范中定义

你在宣言中发现的错误很少见内联说明:

PropertyChanged