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 -> Re: VARCHAR2>32k, Java - modification of Tom Kytes Routine

Re: VARCHAR2>32k, Java - modification of Tom Kytes Routine

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Mon, 20 Jan 2003 19:06:45 +0300
Message-ID: <b0h6qn$oq3$1@babylon.agtel.net>


oracle.sql.BLOB provides a getBinaryStream() and CLOB provides getAsciiStream() for reading LOBs, and getBinaryOutputStream()/getAsciiOutputStream() for writing them. CLOB also provides Reader and Writer getters to simplify things even further. Using streams in Java is nearly trivial, so there should be no problem implementing your proc.

--
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"Peter Sulikowski" <peterjsulikowski_at_hotmail.com> wrote in message
news:44442672.0301170630.4dff6f45_at_posting.google.com...

> Hi, this is one of Tom Kytes sample apps that works perfectly from:
>
> http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:650337598357
>
> I have a problem and it isn't Toms but, I think, a limit of 32K on a
> VARCHAR2. I've posted a reply to Tom, he's a pretty busy chap and I'm
> wanting ideas on a resolution rather quickly. Can anyone suggest a way
> to return character data >32K by modifying this code.
>
> The best solution for me would be something like:
>
> procedure getContentClob(p_content OUT CLOB)
> is language java name 'Test.getContent(oracle.sql.CLOB[])';
>
> OR
>
> function getContentClob return clob;
>
> But I'm not sure how to code the Java properly in "Test" to return the
> clob.
>
> Thank you
> Peter
>
>
>
>
> -- Here down from Tom's web-site.
>
> create or replace and compile java source named "Test" as
> class Test
> {
> private static String strContent_;
> public static void setContent(String strContent)
> {
> strContent_ = strContent;
> }
> public static void getContent(String[] p_content)
> {
> p_content[0] = strContent_;
> }
> }
> /
>
> create or replace package testjava as
> procedure setContent(p_content VARCHAR2)
> is language java name 'Test.setContent(java.lang.String)';
> function getContent return varchar2;
> procedure getContent(p_content OUT varchar2)
> is language java name 'Test.getContent(java.lang.String[])';
> end testjava;
> /
>
> create or replace package body testjava as
> function getContent return varchar2
> is
> l_data long;
> begin
> getContent(l_data);
> return l_data;
> end;
> end testjava;
> /
>
>
>
> exec testjava.setcontent( rpad('*',32000,'*') )
> exec dbms_output.put_line( length(testjava.getcontent) )
>
>
>
> exec testjava.setcontent( rpad('*',33000,'*') )
>
> --problem here, cannot return > 32K.
> -------------------------------------------------------------
> exec dbms_output.put_line( length(testjava.getcontent) )
>
>
>
>
>
> Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
> PL/SQL Release 8.1.7.0.0 - Production
> CORE 8.1.7.0.0 Production
> TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
> NLSRTL Version 3.4.1.0.0 - Production
Received on Mon Jan 20 2003 - 10:06:45 CST

Original text of this message

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