Examples of Oracle calling Java methods (all of the code below is written in Sql/plus)

Source: Internet
Author: User

Call the Java program in Oracle, note: The Java method must be of type static if you want to use System.out/err output log in Java.

Need to execute "call Dbms_java.set_output (5000);" In Oracle.
First, Helloword
1 Write Java program, also write in Sql/plus, and execute.


Create or replace and compile Java source named Hello as
public class Hello {
static public string Message (string name) {
Return "Hello," + name;
}
}
/

2 Publishing Java Programs


Create or Replace function hello (name VARCHAR2) return VARCHAR2
As language Java name
' Hello.message (java.lang.String) return java.lang.String ';
/

3 Java programs that use dough

Select Hello (' world! ') from dual;
HELLO (' world! ‘ )
-- -------------
Hello world!

Examples of Oracle calling Java methods (all of the code below is written in Sql/plus)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.