--1)
JAVA Class use in PLSQL block using Function:
Using PLSQL you can run Java stored procedures in the same
way as PLSQL stored procedures.
In oracle database, Java is usually invoked through PLSQL
interface.
-- 1) Create Java class
CREATE OR REPLACE AND COMPILE JAVA
SOURCE NAMED "Technical" AS
public class Technical
{
public static String test007()
{
return "Oracle
Technical";
}
};
/
-- 2) Create PLSQL Function
to call Java class
CREATE OR REPLACE FUNCTION
Technicaltest007
RETURN VARCHAR2 AS
LANGUAGE JAVA NAME
'Technical.test007 () return java.lang.String';
/
-- 3) Write PLSQL Block to
call created Function
SET SERVEROUTPUT ON;
DECLARE
lc_string
VARCHAR2(300);
BEGIN
lc_string :=
Technicaltest007();
dbms_output.put_line('The value of the string is:'||lc_string);
END;
/
No comments:
Post a Comment