我正在尝试创建一个超类型客户服务和子类型代理和主管,所以当我尝试在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) );
答案 0 :(得分:3)
您可以在SQL * Plus或SQL Developer或show errors
中使用select * 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) );