创建视图的SQL错误(使用嵌套表)

时间:2017-04-27 21:29:02

标签: sql oracle views temporal

我遇到了创建视图的基本示例的问题。 这些是表格:

Create or replace type LEVEL_T as object(
  Duties Varchar2(50),
  Charge Number(10),
  NO Date,
  LIDZ Date
);

Create or replace type LEVELS_T as table of LEVEL_T;

Create table BOTS(
  Bot_ID Number(10) constraint pk_bots primary key,
  Name Varchar2(30),
  Class Varchar2(30),
  Start_date Date,
  Levels LEVELS_T
) nested table Levels store as BOTS_LEVELS_COL;

对象:

Create or replace type OBJ_DATE as object(
  Name Varchar2(30),
  Class Varchar2(30),
  Duties Varchar2(30),
  Charge Number(10),
  NO Date,
  LIDZ Date,
  MEMBER function WORKS(P_DATE in Date) return number
  );
Create or replace type body OBJ_DATE as
  MEMBER function WORKS(p_date in Date) return number is
  begin
    if ((p_date >= self.NO AND p_date < self.LIDZ) OR
     (self.LIDZ IS NULL AND p_date >= self.NO)) then
      return 1;
    else
      return 0;
    end if;
  end WORKS;
end;

现在我正试图通过以下方式提出观点:

Create or replace view VIEW_WORK of OBJ_DATE with object identifier(Name) as 
  Select A.Name, A.Class, B.Duties, B.Charge, B.NO, B.LIDZ
  From BOTS A, table(A.Levels) B;

从第1行开始收到错误:ORA-01730:指定的列名无效; 01730. 00000 - “指定的列名无效”。 正在玩这个一点,并且只能设法在删除“对象标识符”周围的部分时工作,但是当试图测试视图时调用函数WORKS(有点讽刺)不会。我现在完全陷入困境,所以关于我做错了什么的提示?

0 个答案:

没有答案