![](/img/trans.png)
[英]How to get column count in SQL before executing the query? i.e. way other than ResultSetMetaData
[英]ResultSetMetadata column types for count()/sum()
在MySQL中,选择:
count(BIGINT)
返回type = -5(BigInteger),我期望Long
sum(SMALLINT)
返回type = 3(BigDecimal),我希望是Integer
有什么可以做的吗?
值-5表示java.sql.Types.BIGINT
,它是Java long
的JDBC / SQL等效项,因此完全可以预期该值。
至于为什么将SUM
映射到3或java.sql.DECIMAL
,我不确定。 这可能就是MySQL在对非浮点类型求和时所做的事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.