【发布时间】:2013-12-12 23:49:09
【问题描述】:
CREATE TABLE the_user( Name VARCHAR(40) not null,
Address VARCHAR(255) not null,
Delivery_address VARCHAR(255),
Email VARCHAR(25) not null,
Phone INTEGER not null,
Status INTEGER not null,
Password VARCHAR(25) not null,
DOB DATE not null,
PRIMARY KEY (Email),
FOREIGN KEY (Status) REFERENCES User_Status (Status_Id),
CONSTRAINT check_Password CHECK (Password > 4)
);
INSERT INTO the_user VALUES (
'Pergrin Took',
'12 Bag end, hobbiton, The Shire, Eriador',
'The address, Dublin',
'ptook@lotr.com',
'8679046',
'001',
'treebeard',
TO_DATE('2013/11/04 14:11:34', 'yyyy/mm/dd hh24:mi:ss')
);
我在 Oracle 中有上述数据库,但是当我尝试运行插入命令时,我得到一个 ORA-1722 错误,Invalid Number。 user_status 表中有一个条目,对应于插入中的 1。
我已经坚持了好几天了。
【问题讨论】:
-
数字不能用单引号括起来:
'8679046'是字符串值,8679046是数字。'001'也不是数字。