oracle JDBC + PL/SQL = 这么简单,还是有什么难点?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3901707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 21:41:24  来源:igfitidea点击:

JDBC + PL/SQL = Is it so simple, or is there a catch?

javaoraclejdbcplsql

提问by Xorty

I am planning to execute Oracle PL\SQL blocks via JDBC (can't test it yet, question of few days). Is there anything I should know? Does everything work as it used to with plain SQL?

我计划通过 JDBC 执行 Oracle PL\SQL 块(还不能测试,几天的问题)。有什么我应该知道的吗?一切都像以前一样使用普通 SQL 吗?

I mean:

我的意思是:

ResultSet rs = st.executeQuery("DECLARE BEGIN NULL; END;");

Or will I need some custom classes? I'd like to keep it as much simple as possible (no ORM etc.).

或者我需要一些自定义类?我想让它尽可能简单(没有 ORM 等)。

Thanks!

谢谢!

采纳答案by Pascal Thivent

It is possible to call PL/SQL anonymous blocks using a standard CallableStatement(and Oracle JDBC drivers of course). See Returning data from anonymous PL/SQL blockfor some example code.

可以使用标准CallableStatement(当然还有 Oracle JDBC 驱动程序)调用 PL/SQL 匿名块。有关示例代码,请参阅从匿名 PL/SQL 块返回数据

See also

也可以看看