Search code examples
javaoraclejdbcplsqlora-06512

Call PL/SQL Web Toolkit procedures from Java


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.


Solution

  • 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.