Oracle10g 甲骨文;ORA-00904::无效标识符";=Oracle 10 G上的粗体SQL命令出错
Oracle10g 甲骨文;ORA-00904::无效标识符";=Oracle 10 G上的粗体SQL命令出错,oracle10g,Oracle10g,shift是保留字。您需要以不同的方式命名该列 永远不要将日期存储为char或varchar列! 此外,名称date也不是一个很好的选择。除了作为保留字外,它并没有记录该列的内容。“开始日期”、“结束日期”、“加入日期”、“到期日期” 使用chardatatype几乎总是无法实现您想要的功能,因为它的值被填充到定义的长度。我很确定你想要的是varchar(或者varchar2) 如果您的id(cor_id,…)实际上是数字,则应将这些列定义为number(或integer) 因此,所讨论的表格至
shift
是保留字。您需要以不同的方式命名该列
永远不要将日期存储为char
或varchar
列!
此外,名称date
也不是一个很好的选择。除了作为保留字外,它并没有记录该列的内容。“开始日期”、“结束日期”、“加入日期”、“到期日期”
使用char
datatype几乎总是无法实现您想要的功能,因为它的值被填充到定义的长度。我很确定你想要的是varchar
(或者varchar2
)
如果您的id(cor_id
,…)实际上是数字,则应将这些列定义为number
(或integer
)
因此,所讨论的表格至少应如下所示:
create table Coordinator(
cor_id char(6) primary key,
cor_name varchar(10) not null,
contact_no char(12),
address varchar(50));
create table Student(
student_id char(6) primary key,
name varchar(10) not null,
department char(20),
grade char(6),
percentage smallint,
contact_no char(12),
address varchar(50));
create table Criteria(
crt_id char(6) primary key,
min_cutoff smallint);
create table Company(
cmp_id char(6) primary key,
crt_id char(6),
cmp_name varchar(25) not null,
grade char(6),
package int,
contact_no char(12),
address varchar(50),
foreign key (crt_id) references Criteria(crt_id));
**create table Coordinate_with(
cor_id char(6),
cmp_id char(6),
date char(10),
shift varchar(10),
primary key (cor_id,cmp_id),
foreign key (cor_id) references Coordinator(cor_id),
foreign key (cmp_id) references Company(cmp_id));**
create table Placed_in(
cmp_id char(6),
student_id char(6),
primary key (cmp_id,student_id),
foreign key (comp_id) references Company,
foreign key (student_id) references Student);
create table Criteria_Branch(
crt_id char(6),
branch_allowed varchar(20),
primary key (crt_id, branch_allowed),
foreign key (crt_id) references Criteria(crt_id);
create table Coordinate_with
(
cor_id char(6),
cmp_id char(6),
start_date date, -- or whatever name describes better what kind of date that is.
shifted varchar(10), -- the name is just a suggestion, use what best describes this column
primary key (cor_id,cmp_id),
foreign key (cor_id) references Coordinator(cor_id),
foreign key (cmp_id) references Company(cmp_id)
);