Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Java program in Oracle
"M" <someone_at_microsoft.com> writes:
> Thanks Harald.
>
> I followed your steps and so far it's alright except that I have
> error in the statement
> "call helloworld() into :res" !
>
> I tried "select helloworld() into :res from dual" but still not
> work!
Here the output, so it should be fine:
,----
| SQL> select helloworld() from dual; | | HELLOWORLD() | ------------------------------------------------------------------------- | Hello world
I assume you did some thing wrong. Make sure you are using the same user e.g. scott. Reports the system an error?
Harald
> I wrote:
>> ,----[ Hello.java ]
>> | /* Note: this class is not executable because the class specification
>> | * does not have a main function.
>> | */
>> |
>> | public class Hello{
>> | public static String world (){
>> | return "Hello world";
>> | }
>> | }
>> `----
>>
>> ,----[ Hello.sql ]
>> | connect scott/tiger;
>> | create or replace function HELLOWORLD return VARCHAR2 as
>> | language java name 'Hello.world () return java.lang.String';
>> | /
>> `----
>>
>> ,----[ HelloTest.sql ]
>> | connect scott/tiger;
>> | variable res varchar2(20);
>> | call helloworld() into :res;
>> | print res;
>> `----
Received on Sun Aug 31 2003 - 05:38:36 CDT