1

我从数据库中选择 ts:ts =Select ts from ... 所以现在我的变量中有 oracle.sql.TIMESTAMP。现在我需要选择具有此时间戳的所有记录:

select * from ... where time = ts

我怎么能这样?

4

1 回答 1

4

尝试PreparedStatementJavadoc):

PreparedStatement pstmt = connection.prepareStatement("select * from ... where time = ?");
pstmt.setTimestamp(1, timestamp);
ResultSet rs = pstmt.executeQuery;
于 2012-05-14T09:19:08.987 回答