开发者

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

开发者 https://www.devze.com 2023-01-19 22:30 出处:网络
I am planning to execute Oracle PL\\SQL blocks via JDBC (can\'t test it yet, questio开发者_如何学Gon of few days). Is there anything I should know? Does everything work as it used to with plain SQL?

I am planning to execute Oracle PL\SQL blocks via JDBC (can't test it yet, questio开发者_如何学Gon of few days). Is there anything I should know? Does everything work as it used to with plain 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.).

Thanks!


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 block for some example code.

See also

  • Oracle® Database JDBC Developer's Guide and Reference
    • Stored Procedure Calls in JDBC Programs
0

精彩评论

暂无评论...
验证码 换一张
取 消