簡體   English   中英

oracle11g sql:警告:類型創建時有編譯錯誤

[英]oracle11g sql: Warning: Type created with compilation errors

我正在嘗試創建一個超類型客戶服務和子類型代理和主管,因此當我嘗試在 oracle sql 中運行它時,它們可以具有固有值:出現一條消息

Warning: Type created with compilation errors.

下面的代碼有什么問題?

Create or replace type customer_s_type as object (
   csID number, 
   csName varchar(15),
   csType number ) NOT FINAL;

Create or replace type supervisor_type UNDER customer_s_type ( title varchar (10) );  

Create or replace type agent_type UNDER customer_s_type (title varchar (10)); 

Create table supervisor of supervisor_type (
   CONSTRAINT supervisor_PK PRIMARY KEY (csID));

Create table agent of agent_type (CONSTRAINT agent_PK PRIMARY KEY (csID));

create table customer_service(
   csID number(10),
   csType number(10),
   constraint supervisor_pk primary key(csID) );

您可以在 SQL*Plus 或 SQL Developer 中使用show errorsselect * from user_errors來查看錯誤詳細信息。

由於您已經顯示了六個命令,並且警告是關於前三個命令之一(因為它指的是type ),並且除了在注釋中指出的約束之外,它們看起來還可以,看起來整個腳本都被解釋為一個命令。 這取決於您的客戶端設置,但您可能只需要用/分隔命令即可使它們執行。 因為類型可以包括 PL/SQL ; 不被視為語句分隔符。 所以:

Create or replace type customer_s_type as object (
   csID number, 
   csName varchar(15),
   csType number ) NOT FINAL;
/

Create or replace type supervisor_type UNDER customer_s_type ( title varchar (10) );
/

Create or replace type agent_type UNDER customer_s_type (title varchar (10));
/

Create table supervisor of supervisor_type (
   CONSTRAINT supervisor_PK PRIMARY KEY (csID));

Create table agent of agent_type (CONSTRAINT agent_PK PRIMARY KEY (csID));

create table customer_service(
   csID number(10),
   csType number(10),
   constraint customer_service_pk primary key(csID) );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM