Skip to Main Content
Oracle PL/SQL Programming: A Developer's Workbook
book

Oracle PL/SQL Programming: A Developer's Workbook

by Steven Feuerstein, Andrew Odewahn
May 2000
Intermediate to advanced content levelIntermediate to advanced
594 pages
11h 32m
English
O'Reilly Media, Inc.
Content preview from Oracle PL/SQL Programming: A Developer's Workbook

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; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle Database 12c PL/SQL Programming

Oracle Database 12c PL/SQL Programming

Michael McLaughlin
Oracle PL/SQL for DBAs

Oracle PL/SQL for DBAs

Arup Nanda, Steven Feuerstein
Oracle PL/SQL For Dummies

Oracle PL/SQL For Dummies

Michael Rosenblum, Paul Dorsey

Publisher Resources

ISBN: 9781449324070Supplemental ContentErrata Page