You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

PL/SQL Boolean Type in JDBC

edited Mar 14, 2019 8:18AM in Database 1 comment

Summary

PL/SQL Boolean Type in JDBC

Content

We are looking for a way to handle PL/SQL Boolean type in stored procedures. PL/SQL Boolean type types can be present in below two ways within stored procedures - 

1) Directly as a IN/OUT parameter e.g. 

create or replace procedure boolean_proc(param1 in Boolean
IS
BEGIN.......

2) As part of PL/SQL record type e.g. 

create or replace package TEST_PKG is
   
   type R_TYP is record(c1 boolean);

   procedure REC_PROC(p1 in R_TYP, p2 OUT R_TYP);
end;..........

While calling such stored procedures, we need to map Java Boolean type i.e. "true" or "false" in case 1 and Java Integer type "0" or "other than 0" for second case while constructing Structs for Record. Is there any way to uniformly handle Boolean type in both cases?? Basically either use Java Boolean for both cases or use Java Integer for both cases.  Any further suggestions??

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!