read Oracle® Database Java Developer's Guide and tested program with "loadjava" command-line.
$ loadjava -user java_user/password -oci8 Oscar.classError while creating class OscarORA-06550: line 1, column 91:PLS-00201: identifier 'NameFromLastDDL' must be declaredORA-06550: line 1, column 85:PL/SQL: Statement ignoredThe following operations failedclass Oscar: creation (createFailed)exiting : Failures occurred during processing
So, Check Java Enabled on Database.
SQL> select owner, object_name, object_type from all_objects where object_name like '%NameFromLastDDL%' ;no rows selectedSQL> select comp_name, status from DBA_REGISTRY where upper(comp_name) like '%JAVA%' ;no rows selected
and then install java on exist database by initjvm.sql script.
http://download.oracle.com/docs/cd/B19306_01/install.102/e10319/java.htm#DFSIG276
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/scripts005.htm#sthref2935
run $ORACLE_HOME/javavm/install/initjvm.sql script.
SQL>@?/javavm/install/initjvm.sql
.
.
.
SQL> select owner, object_name, object_type from all_objects where object_name like '%NameFromLastDDL%' ;OWNER OBJECT_NAME OBJECT_TYPE--------------- ------------------------------ -------------------SYS NameFromLastDDL FUNCTIONPUBLIC NameFromLastDDL SYNONYMSQL> select comp_name, status from DBA_REGISTRY where upper(comp_name) like '%JAVA%' ;COMP_NAME STATUS------------------------------------------------JServer JAVA Virtual Machine VALID
After make sure a java enabled on database, So run "loadjava" again.
$ loadjava -user java_user/password -oci8 Oscar.class
"No Error"
and it's test program:
SQL> CREATE FUNCTION oscar_quote RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'Oscar.quote() return java.lang.String';SQL>VARIABLE theQuote VARCHAR2(50);SQL>CALL oscar_quote() INTO :theQuote;SQL>PRINT theQuote;THEQUOTE---------------------------------------------------I can resist everything except temptation
and then read and test...
No comments:
Post a Comment