SQL Oracle 错误

发布于 2024-12-11 05:04:27 字数 1072 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

辞取 2024-12-18 05:04:27

此错误清楚地表明您试图在 tour_concerts 表的第三列中插入太长的 varchar 值。

您可以通过以下方法解决此问题:

  1. 更改表的结构以使该列接受 30 个以上的字符。例如,50 是失败语句的字符数。

    alter tabletour_concertsmodifycolumn_namevarchar2(50)

  2. 使用Oraclesubstr 函数:

    `插入tour_concerts value ('6', to_date('02/01/1974', 'DD/MM/YYYY'), substr('Freddie Mercury 艾滋病意识致敬音乐会', 0, 30), ' UK');

  3. 如果这些记录例如通过 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:

  1. 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)

  2. 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');

  3. If these records are inserted thorugh an application via jdbc for instance, trim user input to not exceed your table's maximum sizes.

别在捏我脸啦 2024-12-18 05:04:27

错误很明显:TOUR_CONCERTS.TYPE 字段允许 30 个字符,不能再多,并且您正在尝试插入更长的字符串。
您有两种方法可以解决此问题:

  1. 缩短您插入的字符串(Freddie Mercury Tribute Concert for AIDS Awareness 长度超过 30 个字符)
  2. 更改表定义并设置 TOUR_CONCERTS.TYPE 字段长度为更高的值(比如 200?)

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:

  1. Shorten string you're inserting (Freddie Mercury Tribute Concert for AIDS Awareness is longer than 30 chars)
  2. Change your table definition and set TOUR_CONCERTS.TYPE field length to an higher value (say 200?)
堇色安年 2024-12-18 05:04:27

嗯。我认为你应该改变你的桌子。30 太短了。
如果你的数据库是oracle:

alter table YOURTABLE alter column 'S3327043' varchar(100)

Huh.I think you should alter your table.30 is too short.
If your DB is oracle:

alter table YOURTABLE alter column 'S3327043' varchar(100)
甜柠檬 2024-12-18 05:04:27

检查这篇文章似乎您试图插入比字段更长的值,使字段更大超过您可能需要的最大值。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文