Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/307.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.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
Java 不兼容的数据类型(hypersql)_Java_Jdbc_Hsqldb_Jdbc Odbc - Fatal编程技术网

Java 不兼容的数据类型(hypersql)

Java 不兼容的数据类型(hypersql),java,jdbc,hsqldb,jdbc-odbc,Java,Jdbc,Hsqldb,Jdbc Odbc,为什么我应该得到不兼容的数据类型错误 int blockSize = 100; String city="London"; " select * from"+ "(" + " select l.* from lottotable as l where l.city='"+city+"' and l.date< cast('"+date+"' as date) order by l.date desc " + ")" + " order by date asc limit CONVERT(

为什么我应该得到不兼容的数据类型错误

int blockSize = 100;
String city="London";
" select * from"+
"(" +
" select l.* from lottotable as l where l.city='"+city+"' and  l.date< cast('"+date+"' as date) order by l.date desc " +
")" +
" order by date asc limit CONVERT("+blockSize+", SQL_INTEGER )"
错误是:

java.sql.SQLSyntaxErrorException:操作中的数据类型不兼容:;在LIMIT、OFFSET或FETCH in语句中[select*from select l.*from lottotable as l其中l.city='London'和l.date 德比正常关闭

更新: 桌子的结构很简单 乐透日期、城市、P1、P2、P3、P4、P5;
p1到p5是整数,date是date类型,city是varchar

按照注释中的建议更改查询:

int blockSize = 100;
String city="London";
String queryText =
    " select * from"+
    "(" +
    " select l.* from lottotable as l where l.city='"+city+"' and  l.date< cast('"+date+"' as date) order by l.date desc " +
    ")" +
    " order by date asc limit "+blockSize;

我对java不是很熟悉,因为它最初被标记为MySQL,但我想发布您的表结构可能会有所帮助。为什么限制CONVERT100,SQL\u INTEGER而不是限制100…?限制CONVERT+blockSize+,SQL\u INTEGER,blockSize是一个传递的变量,首先检查代码,然后检查错误…我是问你为什么认为你需要转换函数。