Java Function in Oracle function

Posted on 2011-10-17
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
    LVL 6

    Expert Comment

    by:Javier Morales
    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


    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

    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 ?
    LVL 6

    Accepted Solution

    Yes, it should work.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
    From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now