CallableStatement vs语句 [英] CallableStatement vs Statement

查看:103
本文介绍了CallableStatement vs语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调用无参数且无输出的存储过程时,使用 CallableStatement noreferrer>声明或 PreparedStatement ?

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?

推荐答案

CallableStatement允许您使用通用的JDBC语法来调用过程,而不是数据库特定的语法.

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

可悲的是,在我从事的一个项目中,我们没有为Oracle做到这一点,所以我们所有的过程调用看起来都像这样:

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;";

这篇关于CallableStatement vs语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆