SQL> create table Orders(
2 order_ID number(5) primary key,
3 order_Date date,
4 customer_ID number(3),
5 Distributor_ID varchar2(8),
6 Distributor_Fee varchar2(6),
7 total_Due varchar2(7),
8 foreign key(customer_ID) references customer(customer_ID));
Table created.
SQL> insert into orders
2 (order_ID, order_Date, customer_ID, Distributor_ID, Distributor_Fee, total_Due)
3 values (34561, '07/04/2008', 23, 'DEN8001', '$22.00', '$145.74');
values (34561, '07/04/2008', 23, 'DEN8001', '$22.00', '$145.74')
*
ERROR at line 3:
ORA-01843: not a valid month
答案 0 :(得分:0)
尝试执行此操作(我删除了除日期字段以外的所有字段,以查明问题所在)
insert into orders (..., order_Date, . . . )
values (. . . , TO_DATE('07/04/2008', 'MM/DD/YYYY'), . . . .);
基本上,您需要使用“格式模型”将varchar2
转换为date
。我不知道您的所在地,因此您可能需要将MM/DD/YYYY
切换为DD/MM/YYYY
。
将来可能还会遇到的其他问题-将数字数据另存为字符串...以为有一天您可能需要计算总计或类似内容。