Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CallableStatement vs Statement

When calling a Stored Procedure with no arguments and no output is there any advantage to using a CallableStatement over a regular Statement or PreparedStatement?

like image 447
C. Ross Avatar asked Aug 25 '10 19:08

C. Ross


1 Answers

CallableStatement allows you to use a generic JDBC syntax for calling procedures rather than a Database specific one.

Sadly, we didn't do that for Oracle in one of the projects I've worked on, so all our procedure calls look something like this:

String query = "begin package.sp_Procedure(?, ?); end;";
like image 108
Powerlord Avatar answered Nov 11 '22 08:11

Powerlord