1.创建java source
create or replace and compile java source named tony as
public class tony
{
public static String getStrMsg(String str)
{
return str+"\t 共有字符:"+str.length()+"个";
}
}
2.创建调用函数
create or replace function javaTest(str varchar2)
return varchar2 as
LANGUAGE JAVA NAME 'tony.getStrMsg(java.lang.String) return java.lang.String';
3.执行测试
select javatest('abcd') from dual ;
4.结果
abcd 共有字符:4个