Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9217505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:38:55+00:00 2026-06-18T02:38:55+00:00

My stored function creates temporary LOB instance using: Dbms_Lob.CreateTemporary(BUFFER, TRUE, Dbms_Lob.SESSION); where BUFFER is

  • 0

My stored function creates temporary LOB instance using: Dbms_Lob.CreateTemporary(BUFFER, TRUE, Dbms_Lob.SESSION); where BUFFER is a local CLOB variable. After that the function fills BUFFER with some data and returns it.

Duration parameter of Dbms_Lob.CreateTemporary in my case is Dbms_Lob.SESSION, but according to oracle documentation:

The duration parameter passed to dbms_lob.createtemporary() is a hint.
The duration of the new temp LOB is the same as the duration of the
locator variable in PL/SQL. For example, in the preceding program
block, the program variable a has the duration of the residing frame.
Therefore at the end of the block, memory of a will be freed at the
end of the function.

So BUFFER CLOB may be destroyed by Oracle after leaving the function block. I can see that in some cases, when the BUFFER is more than 32K, I can’t read it’s value returned this way from Java (JDBC) side.

Is there any other way to return temporary CLOB instance from a function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:38:56+00:00Added an answer on June 18, 2026 at 2:38 am

    In a comment you said:

    clob.getSubString(0, clob.length()) throws: java.sql.SQLException:
    Invalid argument(s) in call at
    oracle.sql.CLOB.getSubString(CLOB.java:236)
    while clob.length()
    returns actual length of my clob

    The documentation of getSubString states that:

    pos – the first character of the substring to be extracted. The first character is at position 1.

    With a simple function to generate and return a CLOB, I can retrieve it over JDBC (ojdbc5 or ojdbc6) with no problems, either with getCLOB() or getString(). But if I try to assign the Oracle.sql.CLOB retrieved with getCLOB to a String using

    String x = getSubString(0, clob.length());
    

    then I also get the Invalid argument(s) in call error. Just changing that to:

    String x = getSubString(1, clob.length());
    

    works. So it seems to have nothing to do with the temporary allocation in the function, or the CLOB size. I don’t understand why you didn’t have a problem with smaller CLOBs – maybe your logic just didn’t hit this if they were small?

    In the meantime you’ve worked around this with clob.getCharacterStream().read(), so this may be a bit irrelevant now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any chance to create temporary stored procedure or function on MS SQL
I want to create a Postgres Stored function in plpgsql that creates a table
I have a stored function where I use temporary tables. For performance reasons, I
I have a stored function CREATE OR REPLACE FUNCTION schedule(name in varchar2,pass in varchar2
This function creates & stores a cookie, and here it stores the name of
I want to create stored procedure that call recursion function, each time it will
I call stored function with such signature: FUNCTION ADDDAYS (city VARCHAR2, startDate DATE, numDays
I just wrote a stored function to calculate the working days between two dates.
If I have function names stored as strings in a Hashtable. Is there a
I need to make a stored procedure or function that returns a set of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.