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

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.