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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Java program in Oracle

Re: Java program in Oracle

From: Harald Maier <maierh_at_myself.com>
Date: Sun, 31 Aug 2003 12:38:36 +0200
Message-ID: <m3y8xai02b.fsf@ate.maierh>

"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

Original text of this message

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