Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Java Function in Oracle function

Posted on 2011-10-17
Medium Priority
Last Modified: 2012-08-14
Hi guys,

I have a rather urgent problem.

I have a java function which is called inside an oracle (11g r2) procedure.
Now there is a problem inside that java function. I think I have fixed the java code but now to test it.

The definition of that function is myfunc(inClob CLOB, outBlob BLOB);

Now my problem is that while I have some knowledgeof Java and a bit of SQL combining and testing it is a bit ourside my scope and I do not have access to the oracle calling code so I can not run anything there.

As far as I understand it the inClob contains some simple text and the outBlob contains the modified data.
The modified data will be written to a file.

What I now need help isis either some example SQL code of how to save that modified java code into the database and how to call it so that it writes out a file or if that is too complex then how do I texst the clob and blob parameters inside java as they are both just interfaces and the serialblob is also not helping.

Any suggestions or ideas are greately appreciated.


Question by:Pete2003
  • 2

Expert Comment

by:Javier Morales
ID: 36982463
clob's are Character large objects.
blob's are binary large objects.

to write a file use UTL_FILE package, valid for text data.
Here you may find some samples...

Hope it will help! :) Cheers,
LVL 47

Expert Comment

ID: 36982687

I am not sure that this is very close to waht you plan to do - it is not obvious
that they are talking about java stored procedures here, but they have
lots of java code examples about rreading and writing Clobs and Blobs - perhaps
this could help:

Author Comment

ID: 36982730
Hi thanks for the reply.

So now with that can I just use a get_line to read a text file into a clob and put_raw to write the contents of the blob ?

Accepted Solution

Javier Morales earned 2000 total points
ID: 36984249
Yes, it should work.

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question