我从数据库中选择ts:ts = Select ts from ...
所以现在我在我的变量中有oracle.sql.TIMESTAMP。现在我需要选择此时间戳记中的所有记录:选择带时间戳的记录
select * from ... where time = ts
我该如何做到这一点?
我从数据库中选择ts:ts = Select ts from ...
所以现在我在我的变量中有oracle.sql.TIMESTAMP。现在我需要选择此时间戳记中的所有记录:选择带时间戳的记录
select * from ... where time = ts
我该如何做到这一点?
尝试PreparedStatement
(Javadoc):
PreparedStatement pstmt = connection.prepareStatement("select * from ... where time = ?");
pstmt.setTimestamp(1, timestamp);
ResultSet rs = pstmt.executeQuery;
sory但这个int工作:我得到这个异常:警告:无法执行:选择*从表where where ts ='[email protected]'因为:ORA-01858:找到一个非数字字符的数字预计 – hudi
这是因为你需要'java.sql.Timestamp',而不是'oracle.sql.Timestamp' –
为什么不能在这个单独的SQL语句来完成? – Chandra