在sql加我是创建表但它给出错误00903:无效的表名

时间:2017-06-27 04:02:37

标签: sql oracle

在sql plus我正在创建一个表,但它正在给出:

  

错误00903:表名无效......

我给了姓名"罪犯"。然后" guilty_dt"。然后" pranshu" ......所有三个案例都是错误的。

create table"convict"(
    "convict_no"varchar2(10),
    "name"varchar2(20),
    "address"varchar2(20),
    "location"varchar2(20),
    "degree"varchar2(10),
    constraint pk primary key("convict_no"),
    constraint fkadd foreign key("address")references("prison"),
    constraint fkloc foreign key("location")references("clocation"),
    constraint chk check("degree"('0d','1d','2d','3d')));

2 个答案:

答案 0 :(得分:2)

使用this语法:

CREATE TABLE table_name
(
  column1 datatype null/not null,
  ...
  CONSTRAINT fk_column
    FOREIGN KEY (column1, column2, ... column_n)
    REFERENCES parent_table (column1, column2, ... column_n)
);

参考 parent_table

答案 1 :(得分:-1)

试试这个: -

1. Why did you use the double quotes in table name and fields name.
2. Where is your parent table in foreign key constraint condition.Must be 
   exist parent table in foreign key constraint.