1). Create a Java class
public class EDCTest1 {
public static String getsometext() {
return "this is test text";
}
}
public static String getsometext() {
return "this is test text";
}
}
2). Load the class into Oracle
loadjava -user scott/tiger -resolve EDCTest1.java
3). Publish in Oracle
sqlplus scott/tiger@oracle
CREATE OR REPLACE FUNCTION EDCTest1 RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'EDCTest1.getsometext() return java.lang.String';
/
/
4). Call the Function
VARIABLE myString VARCHAR2(20);
CALL EDCTest1() INTO :myString;
PRINT myString;
CALL EDCTest1() INTO :myString;
PRINT myString;
5). Other Notes:
To drop a java class:
dropjava -u scott/tiger EDCTest1 .class