hudi
hudi

Reputation: 16525

Select records with timestamp

I select ts from database: ts = Select ts from ... so now I have oracle.sql.TIMESTAMP in my variable. Now I need to select all record with this timestam:

select * from ... where time = ts

How I can to this ?

Upvotes: 1

Views: 150

Answers (1)

Alex Stybaev
Alex Stybaev

Reputation: 4693

Try PreparedStatement (Javadoc):

PreparedStatement pstmt = connection.prepareStatement("select * from ... where time = ?");
pstmt.setTimestamp(1, timestamp);
ResultSet rs = pstmt.executeQuery;

Upvotes: 4

Related Questions