Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Java Stored Procs in 8.i
In your example the variable test will have no room to receive the value from you java method, the only change you have to do is in the declaration of test to be "test varchar2(20)"
this would allow a value up to 20 bytes to be passed back...
MarcM
"Ben Dover" <dir_at_command.com> wrote in message
news:8of569$je3$1_at_news3.kcnet.com...
> Hello,
>
> I'm just getting started with using Java stored procs in 8.i, and am
having
> a bit of trouble. What I'm trying to do is:
>
> 1. Write a Java method something like this:
>
> public class MyClass {
> public static void GetInfo(String[] output) {
> String s = SomeFunctionReturningString(); // etc.
> output[0] = s;
> }
> }
>
> 2. Publish it like this:
>
> create or replace procedure MyProc(parm1 OUT VARCHAR2)
> as language java name 'MyClass.GetInfo(java.lang.String[])';
>
> 3. To test it, I run the following commands in SQL*Plus:
>
> > var test varchar2;
> > exec MyProc(:test);
> > print :test;
>
> The problem is with the type of the parameter I'm passing to the Java
> method. When I pass a string array, the procedure executes, but the output
> is always a blank string (And I KNOW that SomeFunctionReturningString()
> above is returning a non-blank string). If I specify an array of
characters
> (or StringBuffers), I get an "inconsistent datatypes" error message from
> SQL*Plus. I have to be able to pass multiple parameters in and have them
be
> modified on return from the Java method, so changing the above sample code
> to be a function returning the desired value is not really an option. Does
> anyone have any suggestions about this? I'd be most appreciative of any
> suggestions.
>
> Thanks,
> Kelly
>
> jkelly_at_kcnet_dot_com
>
>
>
>
Received on Tue Aug 29 2000 - 13:14:42 CDT