String s = "Select COUNT(*) From TABLE1 Where ID = ?";
PreparedStatement p = connection.prepareStatement(s);
Object o = (Object)"id";
p.setObject(1, o);
ResultSet r = p.executeQuery();
可以藉由 Oracle SQL Developer 執行以下的查詢(在程式執行前後各一次):
Select FETCHES From V$SQL Where SQL_TEXT = 'Select COUNT(*) From TABLE1 Where ID = :1';