1

I want to invoke my Java class into Oracle Database 12c and then create the function based on my class.

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "Test" AS
import oracle.sql.*;
import java.sql.SQLException;
public class Test {
  public static String readFromBLOB(BLOB inputBLOB, int addID) throwsSQLException {    
    //some code
  }
}

CREATE OR REPLACE FUNCTION READ_BLOB(inputBLOB in BLOB, addID in number) return number
AS LANGUAGE JAVA NAME 'Test.readFromBLOB(oracle.sql.BLOB, java.lang.int) return java.lang.String';

I'm trying to create PL/SQL function based on my Test.readFromBLOB(), but compiler says:

"Error: Note: Recompile with -Xlint:deprecation for details."

Before that I used

import java.sql.*;

instead of

import oracle.sql.*;

and my class and my PL/SQL function created correctly, but when I tried to run that function then I have got an error:

ORA-29531: brak metody readFromBLOB w klasie Test
ORA-06512: przy "SYS.READ_COMMENT", linia 1
ORA-06512: przy linia 12
29531. 00000 -  "no method %s in class %s"
*Cause:    An attempt was made to execute a non-existent method in a Java class.
*Action:   Adjust the call or create the specified method.

I read a lot about it and I know that the issue is caused by Oracle Database which uses BLOB type which in Java is oracle.sql.BLOB, but this type in Java is deprecated. Earlier with java.sql.Blob the problem was that PL\SQL passed to my function oracle.sql.BLOB when my function was accept java.sql.Blob. I don't know what to do. I hope anybody helps me :)

1 Answer 1

1

Use oracle.jdbc.OracleBlob instead.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for reply! I solved myself this problem by changing "java.lang.int" to "int" - stupid me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.