0 Replies Latest reply on Jan 17, 2017 8:54 AM by OraDev16

    Java code in Oracle database 11g. No output.

    OraDev16

      Dear All,

       

      Prelude :

      -----------

      (1) jdk version : jdk1.5.0_22 (Using this version of jdk to make the java code in sync with Oracle DB 11g; as 11g uses jdk 1,5)

      (2) Oracle Database : 11.2.0.1.0

       

      Scenario :

      -------------

      (1) I've the following Java code (without main method).

      public class Hello

      {

        public static String world()

        {

          return "Hello world";

        }

      }

      (2) I complied it and got the class file.

      (3) Loaded the class on the server using loadjava.

      (4) Created the following function in SQL Developer.

       

      CREATE OR REPLACE FUNCTION helloworld RETURN VARCHAR2 AS

      LANGUAGE JAVA NAME 'Hello.world () return java.lang.String';

       

      (5) Ran the following three statements.

       

      VARIABLE myString VARCHAR2(20);

      CALL HELLOWORLD() INTO :MYSTRING;

      PRINT myString;

       

      ISSUE :

      ----------

       

      (6) Got blank output.

       

      MYSTRING

      ---------------

       

      Please, suggest me the missing link.

       

      Thank you.