Oracle database has an user JVM to run Java program on the database server, which is much powerful than normal stored procedure. It can bind with standard stored procedure interface to integrate with other database functions. I will show a quick example here, and full document can be found at Oracle official website: https://docs.oracle.com/en/database/oracle/oracle-database/21/jjdev/lot.html#List-of-Tables 2. Load Java code into Oracle database, use Oracle SQL Developer or loadjava command line tool. Here use SQL developer as example: 3. Define Stored Procedure interface 4. Call Java stored procedure 5. Receive procedure output 6. Receive exception stacktrace With the print stack trace section in my example code, you can output error stack to SQL output window, which is helpful to address issues.