Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can Oracle/MySQL provide a functionality just like executeQuery(String sql, Object... args) ?

884731Jun 1 2023

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.

Comments
Post Details
Added on Jun 1 2023
9 comments
474 views