Expert
Q: | |
26-22. | The DDL statement to create the call spec will work fine; it won’t report any creation errors. When you attempt to execute the my_hello procedure, however, you receive an error message stating that there is no method named doIt in the class. The problem is that the method’s name is doit, not doIt (remember, case matters in Java!). To fix the problem, you must change the call spec to match the method name. Here’s the output from SQL*Plus: SQL> SET SERVEROUTPUT ON SQL> EXEC DBMS_JAVA.SET_OUTPUT(1000); PL/SQL procedure successfully completed. SQL> CREATE OR REPLACE PROCEDURE my_hello 2 AS LANGUAGE JAVA 3 NAME 'helloWorld.doIt()'; 4 / Procedure created. SQL> EXEC my_hello java.lang.NoSuchMethodException: No applicable method found .. BEGIN my_hello; END; * ERROR at line 1: ORA-29531: no method doIt in class helloWorld ORA-06512: at "SCOTT.MY_HELLO", line 0 ORA-06512: at line 1 |
Q: | |
26-23. | As in the previous exercise, the call spec compiles but doesn’t run. The problem in this case is that you can publish only static methods. To fix the problem, add the static keyword to the definition of doit, recompile, and reload the class. |
Q: | |
26-24. | The following query displays information about the Java objects in a user schema: SELECT object_name, object_type, status, timestamp FROM user_objects WHERE (object_name NOT LIKE 'SYS_%' AND object_name NOT LIKE 'CREATE$%' AND object_name NOT LIKE 'JAVA$%' AND object_name NOT LIKE 'LOADLOB%') AND object_type LIKE 'JAVA %' ORDER BY object_type, object_name; ... |
Get Oracle PL/SQL Programming: A Developer's Workbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.