Code: 62, e.displayText() = DB::Exception: Syntax error (Multi-statements are not allowed): failed a

2021-12-06 14:30:07 浏览数 (1)

问题:

clickhouse查询语句抛出一下异常: e.displayText() = DB::Exception: Syntax error (Multi-statements are not allowed): 具体堆栈如下:

代码语言:javascript复制
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT count(raba.id) FROM aabbccd.test_all raba where raba.partnerCode = 'demo';
### Cause: ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 62, host: 10.58.10.10, port: 8123; Code: 62, e.displayText() = DB::Exception: Syntax error (Multi-statements are not allowed): failed at position 102 (end of query) (line 1, col 102): ;
FORMAT TabSeparatedWithNamesAndTypes.  (version 21.5.6.6 (official build))

; uncategorized SQLException; SQL state [null]; error code [62]; ClickHouse exception, code: 62, host: 10.58.10.10, port: 8123; Code: 62, e.displayText() = DB::Exception: Syntax error (Multi-statements are not allowed): failed at position 102 (end of query) (line 1, col 102): ;
FORMAT TabSeparatedWithNamesAndTypes.  (version 21.5.6.6 (official build))
; nested exception is ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 62, host: 10.58.10.10, port: 8123; Code: 62, e.displayText() = DB::Exception: Syntax error (Multi-statements are not allowed): failed at position 102 (end of query) (line 1, col 102): ;
FORMAT TabSeparatedWithNamesAndTypes.  (version 21.5.6.6 (official build))
] with root cause

java.lang.Throwable: Code: 62, e.displayText() = DB::Exception: Syntax error (Multi-statements are not allowed): failed at position 102 (end of query) (line 1, col 102): ;
FORMAT TabSeparatedWithNamesAndTypes.  (version 21.5.6.6 (official build))

	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:54)
	at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:29)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.checkForErrorAndThrow(ClickHouseStatementImpl.java:1094)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:773)
	at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQueryStatement(ClickHouseStatementImpl.java:271)
解决方案:

去掉sql后面的分号;字符。

很神奇。

0 人点赞