aspose file tools*
The moose likes JDBC and the fly likes Is it possible to have a store procedre that has PL/SQL code and can call a java obje Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Is it possible to have a store procedre that has PL/SQL code and can call a java obje" Watch "Is it possible to have a store procedre that has PL/SQL code and can call a java obje" New topic
Author

Is it possible to have a store procedre that has PL/SQL code and can call a java obje

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 579
I have written a translation object in java that takes a $en_var in and returns its path.

What I need to do is call that object from a PL/SQL store procedure. All the examples I have seen treat the store procedure as a wrapper around the java object.

But in my store procedure calling the object is only one part of the procedures role:

The store procedure code is :

CREATE OR REPLACE PROCEDURE WRITE_TO_FILE(in_file_name IN VARCHAR, in_en_var IN VARCHAR)

file_handleUTL_FILE.FILE_TYPE;
file_location VARCHAR2(50)

BEGIN

*************************************************************
I need to be able to call the javaobject translation here
file_location = translation.translatePath(in_en_var)
*****************************************************************

file_handle := UTL_FILE.FOPEN(file_location, in_file_name, 'w');
dbms_output.put_line ('input file name opened file name' ||in_file_name ||'-->' ||in_file_location);


UTL_FILE.put_line(file_handle,'Hello Tony);
UTL_FILE.FCLOSE(file_handle);

END WRITE_TO_FILE;
/

I call the java class method translatePath with a string the en_var which returns the path as a string which is then passed as a parameter to UTL_FILE.FOPEN.

Thanks for any help

Tony
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1134

Tony,
You can call another PL/SQL procedure (or function) from within a
PL/SQL procedure (or function). So why not create a java stored
function -- that does the "translation" -- and call it from within
the WRITE_TO_FILE procedure? (Or am I missing something?)

Good Luck,
Avi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to have a store procedre that has PL/SQL code and can call a java obje