PreparedStatements or callableStatements

java, jdbc

Solution

As stated in the CallableStatement API:

The interface used to execute SQL stored procedures.

And as such, it can not be used to execute queries.

Problem

I tried to understand the difference between `PreparedStatements` & `CallableStatements` and I couldn't get it. so please can anyone convert following `sql` Query to `CallableStatement`. I know how to convert Statement into a `PreparedStatement` but having problems with `CallableStatements`. as a `java.sql.Statement` ``` SELECT * FROM Customer WHERE customerId = 'C001' ``` as a `java.sql.PreparedStatement` ``` SELECT * FROM Customer WHERE customerId = ? //set customerId using preparedStatement.setString(1,"C001") ``` How to write this same query in `CallableStatements` Thanks in advance!

Original source

Related problems