Home>

We are considering calling a Java method from Oracle's pl/sql to obtain the processing results.
When I loadjava a Java file to Oracle and run pl/sql, I get an error and I am in trouble.

Error message
FUNCTION func_encrypt (
*
Row 105, column 1:
PLS-00999: implementation restricted (probably temporary) Java methods not permitted here
ORA-06550: row 105, column 1:
PL/SQL: Item Ignored
ORA-06550: row 126, column 3:
PLS-0503: RETURN&VALUE;gt statement is required to return from this function
Applicable source code
public String trgt (String text, String key, String iv) {}

pl/sql
FUNCTION func_encrypts
text IN VARCHAR2,
word IN VARCHAR2,
iv IN VARCHAR2
) RETURN VARCHAR2 AS LANGUAGE JAVA
NAME'trgt (String, String, String) return String&apos ;;
.
.
.
kekka: = func_encrpyt ('abc','def','')

Tried

Grant a role to the database user
I gave permission to the role.
The result is unchanged.

Supplemental information (FW/tool version etc.)

Oracle12c
Java openJdk1.8.0.111

  • Answer # 1

    CREATE OR REPLACE FUNCTION func_encrypts (
    text IN VARCHAR2,
    word IN VARCHAR2,
    iv IN VARCHAR2
    ) RETURN VARCHAR2 AS LANGUAGE JAVA
    NAME'trgt (java.lang.String, java.lang.String, java.lang.String) return java.lang.String&apos ;;

    Registers FUNCTION with Oracle and leaves only the call part in PL/SQL.
    The error has been resolved.

  • Answer # 2

    I don't know Java, but

      

    PLS-0503: Return from this function requires a RETURN<VALUE>statement.

    FUNCTION func_encrypts
        (-Parentheses are required before parameter definition
        text IN VARCHAR2,
        word IN VARCHAR2,
        iv IN VARCHAR2
        )
        RETURN VARCHAR2 IS LANGUAGE JAVA-I don't know how to write around here.
        NAME 'trgt (String, String, String) return String';
    IS
    BEGIN
        RETURN NULL;
    END func_encrypts;
    /


    FUNCTION must execute a RETURN statement within an executable statement. The minimum code that can be executed is faster to write.