SQL Oracle 错误
insert into tour_concerts values
('1', to_date('02/08/1974', 'DD/MM/YYYY'), 'Misc Concerts', 'UK'),
insert into tour_concerts values
('2', to_date('01/01/1977', 'DD/MM/YYYY'), 'The Hoople North America Your', 'USA'),
insert into tour_concerts values
('3', to_date('05/09/1971', 'DD/MM/YYYY'), 'Sheer Heart Attack UK tour', 'UK'),
insert into tour_concerts values
('4', to_date('09/02/1972', 'DD/MM/YYYY'), 'Works Japan tour', 'Japan'),
insert into tour_concerts values
('5', to_date('03/10/1975', 'DD/MM/YYYY'), 'Magic Tour', 'UK'),
insert into tour_concerts values
('6', to_date('02/01/1974', 'DD/MM/YYYY'), 'Freddie Mercury Tribute Concert for AIDS Awareness', 'UK');
SQL> @tour_concerts1;
('6', to_date('02/01/1974', 'DD/MM/YYYY'), 'Freddie Mercury Tribu
te Concert for AIDS Awareness', 'UK')
*
第 2 行错误:
ORA-12899: 列“S3327043”的值太大。“TOUR_CONCERTS”。 “类型”(实际:50,最大:30)
有人可以帮我修复这个错误吗?
好的,我已经修好了
insert into tour_concerts values
('1', to_date('02/08/1974', 'DD/MM/YYYY'), 'Misc Concerts', 'UK'),
insert into tour_concerts values
('2', to_date('01/01/1977', 'DD/MM/YYYY'), 'The Hoople North America Your', 'USA'),
insert into tour_concerts values
('3', to_date('05/09/1971', 'DD/MM/YYYY'), 'Sheer Heart Attack UK tour', 'UK'),
insert into tour_concerts values
('4', to_date('09/02/1972', 'DD/MM/YYYY'), 'Works Japan tour', 'Japan'),
insert into tour_concerts values
('5', to_date('03/10/1975', 'DD/MM/YYYY'), 'Magic Tour', 'UK'),
insert into tour_concerts values
('6', to_date('02/01/1974', 'DD/MM/YYYY'), 'Freddie Mercury Tribute Concert for AIDS Awareness', 'UK');
SQL> @tour_concerts1;
('6', to_date('02/01/1974', 'DD/MM/YYYY'), 'Freddie Mercury Tribu
te Concert for AIDS Awareness', 'UK')
*
ERROR at line 2:
ORA-12899: value too large for column "S3327043"."TOUR_CONCERTS".
"TYPE" (actual: 50, maximum: 30)
Can someone help me fix this error?
OKAY I'VE FIXED IT
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
此错误清楚地表明您试图在
tour_concerts
表的第三列中插入太长的 varchar 值。您可以通过以下方法解决此问题:
更改表的结构以使该列接受 30 个以上的字符。例如,50 是失败语句的字符数。
alter tabletour_concertsmodifycolumn_namevarchar2(50)
使用Oracle
substr
函数:`插入tour_concerts value ('6', to_date('02/01/1974', 'DD/MM/YYYY'), substr('Freddie Mercury 艾滋病意识致敬音乐会', 0, 30), ' UK');
如果这些记录例如通过 jdbc 通过应用程序插入,请修剪用户输入以不超过表的最大大小。
This error is clearly stating that you're trying to insert a too long varchar value in the 3rd column of the
tour_concerts
table.You can fix this by:
Altering the table's structure to make the column accept more than 30 characters. For instance, 50 is the number of characters of the statement that is failing.
alter table tour_concerts modify column_name varchar2(50)
Use the Oracle
substr
function:`insert into tour_concerts values ('6', to_date('02/01/1974', 'DD/MM/YYYY'), substr('Freddie Mercury Tribute Concert for AIDS Awareness', 0, 30), 'UK');
If these records are inserted thorugh an application via jdbc for instance, trim user input to not exceed your table's maximum sizes.
错误很明显:TOUR_CONCERTS.TYPE 字段允许 30 个字符,不能再多,并且您正在尝试插入更长的字符串。
您有两种方法可以解决此问题:
Error is clear: TOUR_CONCERTS.TYPE field allows 30 chars, no more, and you're trying to insert a longer string.
You have two ways to solve this:
嗯。我认为你应该改变你的桌子。30 太短了。
如果你的数据库是oracle:
Huh.I think you should alter your table.30 is too short.
If your DB is oracle:
检查这篇文章似乎您试图插入比字段更长的值,使字段更大超过您可能需要的最大值。
Check this article it seems your trying to insert longer value than the field, make the fields bigger than the maximal value you could need.