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 -> Java stored procedure problem within Oracle8i/Java coding bug?

Java stored procedure problem within Oracle8i/Java coding bug?

From: David <dfairman16_at_hotmail.com>
Date: 23 Jan 2003 07:24:00 -0800
Message-ID: <b4cefdce.0301230724.25872792@posting.google.com>


Up front I have cross-posted this to comp.lang.java.programmer and comp.databases.oracle.server. Apologies. This is the problem part of a huge Java application running from within an Oracle database and I'm not sure whether this is a Java issue or an Oracle issue and therefore where would be the most informative place to post. Below is a Java code snippet wrapped up in a CREATE/REPLACE to execute within Oracle. When I execute within an IDE [not from within Oracle so it is running via main(), copy/paste the bits between the CREATE OR REPLACE AND COMPILE .... and the '/' to reproduce], I get the following printed out on the screen:

Class2$inner1$picC,Class2$inner1$picB,Class2$inner1$picA,

This is what the I expect and want. However when I execute as a Java stored procedure (from SQL/plus), I get the output:

SQL>
SQL> SELECT testRoutines.getClasses AS R1, testRoutines.getDummy R2 FROM DUAL;

R1                  R2
-------------------------------------------
                    dummy
SQL> 

SQL>
SQL> My question is why isn't

'Class2$inner1$picC,Class2$inner1$picB,Class2$inner1$picA,

showing up under the R1 column above. I'm stumped. And having said why, what "magic" can put it there?

Thank you all for thinking about this nastly little problem. David.

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Test" AS public class Class2
{
  private static class inner1
  {

      protected final picC c=new picC(this);

      private static class picA{}
      private static class picB{}

      private static class picC{ 
        private String _classNames="";    
        public picC(Object me){
          Class[] classSet=me.getClass().getDeclaredClasses();
          String classData="";
          for(int i=0;i<classSet.length;i++)            

            _classNames=_classNames+classSet[i].getName()+",";
       }
       public String getClassNames(){
         return _classNames;
       }
      }

      public String getResult(){
        return c.getClassNames();
      }

}

  public static String getDummyString(){     return "dummy";
}

  public static String getClassNames(){
    inner1 x=new inner1();
    return x.getResult();
}

  public static void main(String[] args){     System.out.println(getClassNames());
}

}
/

CREATE OR REPLACE PACKAGE testRoutines AS   FUNCTION getClasses RETURN VARCHAR2
    IS LANGUAGE JAVA NAME 'Class2.getClassNames() return java.lang.String';
  FUNCTION getDummy RETURN VARCHAR2
    IS LANGUAGE JAVA NAME 'Class2.getDummyString() return java.lang.String';
END testRoutines;
/

SELECT testRoutines.getClasses AS R1, testRoutines.getDummy R2 FROM DUAL; SQL>
SQL> SELECT testRoutines.getClasses AS R1, testRoutines.getDummy R2 FROM DUAL;

R1                  R2
-------------------------------------------
                    dummy
SQL> 

SQL>
SQL> And the essential information of course:
SQL> 
SQL> 
SQL> SELECT * FROM V$VERSION;

BANNER



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

SQL>
SQL>

C:\>
C:\>
C:\>java -version

java version "1.3.1_06"
Java(TM) 2 Runtime Environment, Standard Edition (build

1.3.1_06-b01)
Java HotSpot(TM) Client VM (build 1.3.1_06-b01, mixed mode)

C:\> Received on Thu Jan 23 2003 - 09:24:00 CST

Original text of this message

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