我的 sql 查询有问题。
create table rental
(
rental_id NUMBER(5) NOT NULL,
rental_date timestamp NOT NULL,
inventory_id NUMBER(5) NOT NULL,
customer_id NUMBER(5) NOT NULL,
return_date timestamp NOT NULL,
staff_id NUMBER(5) NOT NULL,
constraint rental_primary PRIMARY KEY (rental_id),
constraint rental_foreign FOREIGN KEY (inventory_id) REFERENCES
inventory(inventory_id),
constraint rental_foreign2 FOREIGN KEY (customer_id) REFERENCES
customer(customer_id),
constraint rental_foreign3 FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
constraint rental_unique_rental_date unique (rental_date),
constraint rental_unique_inventory_id unique (inventory_id),
constraint rental_unique_customer_id unique (customer_id),
constraint rental_rental_date check(to_char(rental_date,'YYYY/MM/DD HH:MI:SS AM')
between '2005/01/01 00:00:01 AM' AND '12/31/2015 11:59:59 PM'),
constraint rental_return_date check(to_char(return_date,'YYYY/MM/DD HH:MI:SS AM')
between '2005/01/01 00:00:01 AM' AND '12/31/2015 11:59:59 PM')
);
当我尝试插入数据时,它会抛出此错误“ORA-01843: not a valid month”。谁能建议我可以使用什么类型的数据类型来作为 rent_date 和 return date 来度过这种情况?这是我要上传的示例数据
rental_date return_date
5/24/2011 10:53:30 PM 5/26/2011 10:04:30 PM
注意:我可以在我的 excel 工作表中看到这种类型的格式,其中有我的数据,但是当我收到错误时
"ORA-01843: not a valid month
Row 145: 144, 2011-05-25 23:49:56 ,1689,357, 2011-06-01 21:41:56 ,2"
我在这里观察不同的时间格式。
谁能建议我一个解决方案?
提前致谢。