create table Coordinate_with
(
cor_id char(6),
cmp_id char(6),
start_date date,
shifted varchar(10),
primary key (cor_id,cmp_id),
foreign key (cor_id) references Coordinator(cor_id),
foreign key (cmp_id) references Company(cmp_id)
);
insert into Coordinate_with
values ('COR-01','CMP-02','2009-03-22','Morning');
引发错误 ORA-01861: 文字与格式字符串不匹配。
当您提供“纯”字符串时,该值将根据您的 NLS 设置使用隐式类型转换进行转换。 (标准)日期文字需要关键字date
后跟 ISO 样式 (yyyy-mm-dd) 格式的字符串:
insert into Coordinate_with
(cor_id, cmp_id, start_date, shifted)
values
('COR-01','CMP-02', DATE '2009-03-22','Morning');
或者,您可以使用to_date()
功能:
insert into Coordinate_with
(cor_id, cmp_id, start_date, shifted)
values
('COR-01','CMP-02', to_date('2009-03-22', 'yyyy-mm-dd','Morning');
Btw: work_shift
might have been a better column name for shifted
. I told you, that you will need to find a name that matches what the column contains.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)