Assume String sql = “select * from customers where customer_id = :customer_id and customer_name like :name”;
if the parameters passed in is executeQuery(sql, 1, null), then the real sql to be executed is “select * from customers where customer_id = ?” for java
if the parameters passed in is executeQuery(sql, null, “Smith”), then the real sql to be executed is “select * from customers where customer_name like ?” for java
if the parameters passed in is executeQuery(sql, null, null), then the real sql to be executed is “select * from customers” for java
So the executed sql can be changed automatically according to the parameters passed in.
This functionality is very useful for developers to do their development work.