简体   繁体   English

H2 - (相当)长插入失败,错误 42000

[英]H2 - (Quite) long INSERT failing with error 42000

H2 in-memory - INSERT - Error 42000 H2 内存中 - 插入 - 错误 42000

Tried versions 1.4.196, 1.4.197, 1.4.199.尝试了 1.4.196、1.4.197、1.4.199 版本。

I also tried to execute INSERT on H2 server (local) : also failed我还尝试在 H2 服务器(本地)上执行 INSERT:也失败了

The line giving the error: (sorry but for security reasons I cannot produce more) :给出错误的行:(抱歉,出于安全原因,我无法生成更多):

    INSERT INTO tb_ae (server,  record_id,  ...) 
    SELECT ... 
    FROM   vw_ofch_prepal_delta,   vw_ab_bie  
    WHERE  bie_tp IN ('S[*]') AND is_most_recent = 1;

The statement is 4.004 characters long.该语句的长度为 4.004 个字符。

The error is pointed by H2 as [*] (this is not part of the statement).该错误由 H2 指出为 [*](这不是语句的一部分)。

According to H2 error code documentation, there is syntax error in your query. 根据H2错误代码文档,查询中存在语法错误。

/**
 * The error with code <code>42000</code> is thrown when
 * trying to execute an invalid SQL statement.
 * Example:
 * <pre>
 * CREATE ALIAS REMAINDER FOR "IEEEremainder";
 * </pre>
 */
public static final int SYNTAX_ERROR_1 = 42000;

As your query is too long and not fully copied. 由于您的查询时间太长,无法完全复制。 I advised to review query again or may be review from someone else. 我建议再次查看查询,否则可能会被其他人查看。 You should create small alias for table names and use alias with every column name to avoid syntax error. 您应该为表名创建一个小的别名,并为每个列名使用别名,以避免语法错误。

H2 does not set the error mark [*] inside character string literals. H2不在字符串文字中设置错误标记[*] It means that most likely you have a misplaced ' character somewhere earlier. 这意味着您很可能在更早的位置放错了'字符。 It can be an unclosed string literal, unescaped ' character in some string literal (if a string literal contains the ' character it should be written with two such characters as '' ), or a stray ' character. 它可以是一个未闭合的字符串中,未转义'在一些字符串文字字符(如果文字串包含'字应该有两个这样的字符被写为'' ),或杂散'字符。

This can also happen if you mistakenly wrote an insert like如果您错误地编写了插入内容,也可能发生这种情况

insert into `my_table` (`id`, `name`)
    values (1, 'ENTITY_1'),
    values (2, 'ENTITY_2');

Careless copy-and-paste of "values" twice might not be obvious to the eye.粗心地复制和粘贴“值”两次可能对眼睛来说并不明显。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM