Java 存储过程与 PL/SQL 存储过程 [英] Java Stored Procedure Vs PL/SQL Stored Procedure

查看:42
本文介绍了Java 存储过程与 PL/SQL 存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Oracle DBMS中,性能更好,从另一个pl/sql存储过程调用java存储过程或从另一个pl/sql存储过程调用pl/sql存储过程.

In Oracle DBMS, which is better performance, calling a java stored procedure from another pl/sql stored procedure or calling a pl/sql stored procedure from another pl/sql stored procedure.

顺便说一下,我的 pl/sql 过程中有一个循环会多次调用 java 过程(即我的代码在 PL/SQL 和 Java 存储过程之间切换),所以这会降低性能吗?

By the way I have a loop in my pl/sql procedure that will call the java procedure multiple times (i.e. my code is flipping between PL/SQL and Java Stored Procedures), so does this slow down the performance)?

推荐答案

从一种语言到另一种语言的任何切换都会涉及开销(它可能很小,但仍然存在).如果它在一个循环中,它会被强调.

Any switch from one language to another will involve an overhead (it might be small but it'll still be there). If it's in a loop it will be accentuated.

保持简单,如果你能坚持使用 PL/SQL,那就坚持吧.

Keep it simple and if you can stick to PL/SQL then do so.

Tom Kyte(甲骨文公司副总裁兼大师)有一句格言,在这里重复一遍:

Tom Kyte (Oracle Corporation Vice President and Guru) has a mantra which seems fitting to repeat here:

(参考:http://tkyte.blogspot.com/2006/10/slow-by-slow.html)

  • 如果可能,您应该在单个 SQL 语句中执行此操作.
  • 如果您不能在单个 SQL 语句中完成,那么请在 PL/SQL 中完成.
  • 如果您不能在 PL/SQL 中做到这一点,请尝试使用 Java 存储过程.
  • 如果您不能在 Java 中完成,请在 C 外部过程中完成.
  • 如果您不能在 C 外部例程中做到这一点,您可能需要认真思考为什么需要这样做......

这篇关于Java 存储过程与 PL/SQL 存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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