Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Java Stored Function can't return strings longer than 4096 chars (ORA-24345)

Java Stored Function can't return strings longer than 4096 chars (ORA-24345)

From: Mike R. Prevost <mprevost_at_gradkell.com>
Date: Tue, 14 Aug 2001 17:25:50 -0500
Message-ID: <cwhe7.24201$mz2.1529534@e420r-atl1.usenetserver.com>

I'm running into a size limit that I don't think I should be running into (what else is new). I'm writing a Java stored function and I'm getting an ORA-24345 (A Truncation or null fetch error occurred). I can write a PL/SQL stored function that returns a 32k varchar2. See Sample code below.

Does anyone know why this is? It really looks like a bug. Can someone try it on a different platform?

Here's what I'm running on:

  Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production   JServer Release 8.1.7.0.1 - Production

  RedHat Linux 6.2 with stock SMP kernel version 2.2.14   on a 2 processor 800 Mhz Dell PowerEdge 1400 with 512 MB RAM.

SAMPLE CODE: Here's the Java class:

class CTest
{
  public static String getStringJava( int nSize )   {
    char arrayChars[] = new char[ nSize ];

    for ( int nIndex = 0;

          nIndex < arrayChars.length;
          nIndex++ )
    {
      arrayChars[nIndex] = 'X';

    }

    return new String( arrayChars );
  }
}

Here's the publishing script and test driver:

create or replace function getStringJava( nSize number )

     return varchar2
     as language Java
     name 'CTest.getStringJava(int) return java.lang.String';
/
create or replace function getStringPLSQL return varchar2 is
  strReturn VARCHAR2(32000);
begin
  strReturn := RPAD( 'X', 32000, 'X' );
  return strReturn;
end;
/
DECLARE
  strReturnPLSQL     VARCHAR2(32000);
  strReturnJava      VARCHAR2(32000);

BEGIN

END;
/
exit
-- snip snip ---

Here's the output I get:

Function created.

length of strReturnPLSQL = 32000
length of strReturnJava = 4096
ERROR:
ORA-24345: A Truncation or null fetch error occurred

Thanks.

Received on Tue Aug 14 2001 - 17:25:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US