Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/464.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon redshift [Amazon](500310)读取下一条记录的结果集时出现无效操作错误_Amazon Redshift - Fatal编程技术网

Amazon redshift [Amazon](500310)读取下一条记录的结果集时出现无效操作错误

Amazon redshift [Amazon](500310)读取下一条记录的结果集时出现无效操作错误,amazon-redshift,Amazon Redshift,我们使用java中的JDBC方式从redshift db获取数据。 用于从表中获取数据的查询是 select * from table_name limit 200; 以下是不同表中出现的错误。 我可以在resultset中看到数据。 但在获取特定行的下一条记录时,它抛出了以下错误。请您帮助我们了解错误和解决方法 错误1: `https://forums.aws.amazon.com/(500310) Invalid operation: Invalid input syntax for ty

我们使用java中的JDBC方式从redshift db获取数据。 用于从表中获取数据的查询是

select * from table_name limit 200;
以下是不同表中出现的错误。 我可以在resultset中看到数据。 但在获取特定行的下一条记录时,它抛出了以下错误。请您帮助我们了解错误和解决方法

错误1:

`https://forums.aws.amazon.com/(500310) Invalid operation: Invalid input syntax for type numeric
Details:
error: Invalid input syntax for type numeric
code: 8001
context: value: ""
query: 88634410
location: cg_util.cpp:604
process: query19_773_88634410 https://forums.aws.amazon.com/
-----------------------------------------------;
at com.amazon.redshift.client.messages.inbound.ErrorResponse.toErrorException(Unknown Source)
at com.amazon.redshift.client.PGMessagingContext.handleErrorResponse(Unknown Source)
at com.amazon.redshift.client.PGMessagingContext.handleMessage(Unknown Source)
at com.amazon.jdbc.communications.InboundMessagesPipeline.getNextMessageOfClass(Unknown Source)
at com.amazon.redshift.dataengine.PGResultSet.hasMoreRows(Unknown Source)
at com.amazon.jdbc.common.SForwardResultSet.updateCursorPosition(Unknown Source)`
错误2:用于其他表

`https://forums.aws.amazon.com/(500310) Invalid operation: Divide by zero;
at com.amazon.redshift.client.messages.inbound.ErrorResponse.toErrorException(Unknown Source)
at com.amazon.redshift.client.PGMessagingContext.handleErrorResponse(Unknown Source)
at com.amazon.redshift.client.PGMessagingContext.handleMessage(Unknown Source)
at com.amazon.jdbc.communications.InboundMessagesPipeline.getNextMessageOfClass(Unknown Source)
at com.amazon.redshift.dataengine.PGResultSet.hasMoreRows(Unknown Source)
at com.amazon.jdbc.common.SForwardResultSet.updateCursorPosition(Unknown Source)
at com.amazon.jdbc.common.SForwardResultSet.next(Unknown Source)`
错误3:

`java.sql.SQLException: https://forums.aws.amazon.com/(500310) Invalid operation: operator does not exist: text ||;
at com.amazon.redshift.client.messages.inbound.ErrorResponse.toErrorException(Unknown Source)
at com.amazon.redshift.client.PGMessagingContext.handleErrorResponse(Unknown Source)
at com.amazon.redshift.client.PGMessagingContext.handleMessage(Unknown Source)
at com.amazon.jdbc.communications.InboundMessagesPipeline.getNextMessageOfClass(Unknown Source)
at com.amazon.redshift.client.PGMessagingContext.doMoveToNextClass(Unknown Source)
at com.amazon.redshift.client.PGMessagingContext.getParameterDescription(Unknown Source)
at com.amazon.redshift.client.PGClient.prepareStatement(Unknown Source)
at com.amazon.redshift.dataengine.PGQueryExecutor.<init>(Unknown Source)
at com.amazon.redshift.dataengine.PGDataEngine.prepare(Unknown Source)
at com.amazon.jdbc.common.SPreparedStatement.<init>(Unknown Source)
at com.amazon.jdbc.jdbc41.S41PreparedStatement.<init>(Unknown Source)
at com.amazon.jdbc.jdbc42.S42PreparedStatement.<init>(Unknown Source)
at com.amazon.redshift.core.jdbc42.PGJDBC42PreparedStatement.<init>(Unknown Source)
at com.amazon.redshift.core.jdbc42.PGJDBC42ObjectFactory.createPreparedStatement(Unknown Source)
at com.amazon.jdbc.common.SConnection.prepareStatement(Unknown Source)
at com.amazon.jdbc.common.SConnection.prepareStatement(Unknown Source)`

在看到你的真实记录之前,很难回答这个问题。但我认为在您的某个列中,它可能是无效的数据类型。所有列都是文本还是整数或数字?我建议您使用所有varchar检查数据。(阅读此文以了解我试图传达的内容)以及第二个错误,
https://forums.aws.amazon.com
是分开的,很奇怪,因为它不应该通过
select*
发生,所以请尝试以varcharThanks Bhuvanesh的形式运行select,所有列都作为varcharThanks Bhuvanesh,以获得响应。是的,您的猜测可能是正确的,这是由于无效的数据类型。我的疑问是,我只是从表中选择*,在获取数据时没有进行任何类型转换。数据也会加载到结果集。我的问题是,这是由于映射到进行转换的表的JDBC数据类型造成的吗?我已经用示例更新了帖子,以便更好地分析问题。JDBC从表中读取数据将始终使用varchar数据类型,然后在转换期间将其内部转换为JDBC数据类型?不确定。请这方面的帮助我不知道JDBC驱动程序的内部结构,如果您使用的是红移驱动程序,那么它应该可以工作(或者只是为了尝试,您可以通过psql cli工具运行它吗?)
Please share your thoughts on this