views:

319

answers:

2

I need to call some PL/SQL procedures from my Java application. I can do it with JDBC. But the problem is that procedures are using the "PL/SQL Web Toolkit" and its packages (htp, owa _ util, owa _ cookie, ...). When I call them I get some exceptions as this:

Exception in thread "main" java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.OWA_UTIL", line 323
ORA-06512: at "SYS.HTP", line 859
ORA-06512: at "SYS.HTP", line 974
...

Is possible to call these procedures using a Java package or any other way?

I can't modify these procedures, but I can't create some.

Thanks for your help.

A: 

That error message means that you are passing an argument of the wrong datatype or assigning the result to a variable of the wrong datatype. You need to re-check your code and in particular its assignments. Alterntively you can post your code here: I'm sure one of the SO Brains will be able to spot the problem.

Incidentally, which method in OWA_UTIL are you calling?

APC
Thanks for your answer. I'm sure the procedure arguments are correct. The problem seems to be that some system objects are not created/initialized.The call stack is: MyMethod --> SYS.PRINT('Hello world!') --> SYS.PRN('Hello World') --> OWA_UTIL.GET_CGI_ENV('GATEWAY_IVERSION')
Sinuhe
+1  A: 

htf and htp assume that some things are going to be set up in advance. This is done automatically when the call goes through a PL/SQL gateway like mod_plsql. But it can also be done manually.

There's a good explanation on the Ask Toad wiki

To successfully use htp & htf, you'll need to define a couple variables and then initialize the cgi environment.

Jim Hudson
It seems the perfect solution! I'll work on this now. Thank you very much!
Sinuhe