Home » Developer & Programmer » JDeveloper, Java & XML » Native Java in Oracle vs PL/SQL
Native Java in Oracle vs PL/SQL [message #521175] Fri, 26 August 2011 13:20 Go to next message
manubatham20
Messages: 566
Registered: September 2010
Location: Seattle, WA, USA
Senior Member

Hi,

I just came to know that we can you java code natively with Oracle. But I didn't get the situation, how to decide when to use native java in oracle and when to use pl/sql.

Do you guys have any idea about that? Please suggest me any tutorial from where I can get the required information.

Thanks,
Manu
Re: Native Java in Oracle vs PL/SQL [message #521181 is a reply to message #521175] Fri, 26 August 2011 13:40 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Only when you cannot do something in PL/SQL.

Following T. Kyte's SQL Mantra:

1. Do it in a single SQL statement if at all possible.
2. If you cannot, then do it in PL/SQL (as little PL/SQL as possible!).
3. If you cannot do it in PL/SQL, try a Java Stored Procedure (extremely rarely necessary with Oracle9i and above).
4. If you cannot do it in Java, do it in a C external procedure (when raw speed, or 3rd party API written in C is needed).
5. If you cannot do it in a C external routine, you might want to seriously think.


Regards
Michel
Re: Native Java in Oracle vs PL/SQL [message #521187 is a reply to message #521181] Fri, 26 August 2011 13:47 Go to previous messageGo to next message
manubatham20
Messages: 566
Registered: September 2010
Location: Seattle, WA, USA
Senior Member

Smile

Nice explanation.

May I get any source, from which I come to know, for which things I need to move on Java and C, while having PL/SQL. What are the limitations of PL/SQL that can be done only in Java or C.

Actually I need some test cases. With my little experience I am not able to think when I should move for Java and C natively.

Thanks,
Manu
Re: Native Java in Oracle vs PL/SQL [message #521201 is a reply to message #521187] Fri, 26 August 2011 14:33 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
As Tom said, it is now rare, before there was no package to send mail or access internet within the database, so you have to use Java classes for this. Now this is embedded in some standard PL/SQL packages.
I use Java only to get some system parameters of the database server (System.getProperties), for the moment there is no oequivalent in PL/SQL.
There is no doc on this, just "if you can't do it in one way then go to the next one" rule.
So it depends on your Oracle version and imagination.

Regards
Michel
Previous Topic: Is it Possible
Next Topic: SQL data to be framed the form of XML
Goto Forum:
  


Current Time: Thu Mar 28 12:46:27 CDT 2024