Oracle Certification, Database Administration, SQL, Application, Programming Reference Books
Using the Java Stored Procedure in PL/SQL Procedures and Functions
Following are the Steps For Creating PL/SQL Procedures or Functions Using the java Classes.

1.Load the Java Source Code intothe Database as Follows:
      Inthe Following java class name there is Only one method that is
      Quote which Does nottake anything as the Input but Produces the Output
      in a Form of String which is "I am ablahasdasd".This class is Limited to One Method Only.
 

      Create or Replace java source named"oscar" as
      public class oscar{
      public static String quote(){
      return "I am ablah ";
      }
      }

2)Create the PL/SQL Function or Procedure which uses the java class  and methods For performing the tasks.
      Following is a PL/SQL Function Created which is Invoking the
      quote method of the oscar2 class and Producing the output as
      a String.

      CREATE OR REPLACEFunction Oscar_quote2 Return varchar2
      as LANGUAGE JAVA
      NAME 'oscar2.quote() return java.lang.string';

      /

3)Test theCreated Function or Procedure by writing the Following PL/SQL Blockand see wheather this is Producing the Desired Result or Not .
      Thequotevarchar2(50);
      CallOscar_quote2() into:theQuote;
      Print thequote;
      or Selectoscar_quote() from dual;
      Regarding the Loading the Data Using theSql loader .
      load data infile * append into table TOEICHARD
      fields terminated by ',' optionally enclosed by'"'
      (WORD)
      Begindata
      A.T.M

Return to : Oracle Database, SQL, Application, Programming Tips