Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle function/procedure to call java program

570954May 24 2007 — edited May 25 2007
Hi,

I really need some help on Oracle & Java.

I have this piece of java code which I have loaded into Oracle 10g DB successfully.

The java code seems to be using array to accept input parameters if I'm not wrong.
e.g.
public class JPROG
{
public static void main(String args[])
....
....
System.out.println(param_1);




This java code takes in 3 parameter at runtime and output a string value at the end.

I have created a procedure in Oracle DB to publish this java class.
This procedure was created successfully using:

CREATE OR REPLACE PROCEDURE JPROG_main_proc (s1 VARCHAR2,s2 VARCHAR2,s3 VARCHAR2)
AS LANGUAGE JAVA NAME 'JPROG.main(java.lang.String[])';

When I execute this procedure, it is giving:
call JPROG_main_proc ('-e','3YYHH7987asdjkhfd','HELLO');
ERROR at line 1:
ORA-29515: exit called from Java code with status 0

It seems like it is not able to display the output results from the java class.

Do I have to create an Oracle function to call this java class which will output a result at the end?

I have also tried creating an Oracle function to call this java class using:

CREATE OR REPLACE FUNCTION JPROG_main_func (s1 VARCHAR2,s2 VARCHAR2,s3 VARCHAR2)
RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'JPROG.main(java.lang.String[])
return java.lang.String';
/

However, it keep giving error at compilation.
0/0 PL/SQL: Compilation unit analysis terminated
4/3 PLS-00311: the declaration of "JPROG.main(java.lang.String[])
return java.lang.String" is incomplete or malformed

How do I solve this?

Cheers
Jim
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 22 2007
Added on May 24 2007
7 comments
1,473 views