Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: JDBC registerOutParameter as BOOLEAN?
the Oracle JDBC driver does not allow the use of the PL/SQL BOOLEAN datatype as an argument or return value of a stored procedure or function.
the workaround is to implement a PL/SQL stored procedure or function as a "wrapper" to convert the datatype of the argument(s).
e.g.
CREATE OR REPLACE FUNCTION returnBoolChar
(as_arg1 VARCHAR2
) RETURN VARCHAR2
is
lb_return BOOLEAN;
ls_return VARCHAR2(5) ;
begin
lb_return := returnBoolean(as_arg1);
IF lb_return THEN
ls_return := 'TRUE';
ELSIF NOT lb_return THEN
ls_return := 'FALSE';
ELSE
ls_return := NULL;
END IF;
RETURN ls_return;
END;
then call the wrapper function instead of the one that returns
the unsupported datatype.
cstmt = conn.prepareCall("begin ? := returnBoolChar( ? ); end;");
btw... there are other PL/SQL datatypes which are also not supported by the JDBC driver. e.g. "indexed by" tables.
this limitation is covered in the Oracle JDBC documentation, as well as in several articles available from metalink.
HTH
"Don" <don_b_at_my-deja.com> wrote in message
news:94838q$8h6$1_at_nnrp1.deja.com...
> am trying to call a PL/SQL function that returns a boolean
>
> cstmt = conn.prepareCall("{ ? = call returnBoolean(?) }");
>
> however, I can't seem to registerOutParameter #1 since there is no
> java.sql.Types.BOOLEAN
>
> these all fail where XXX is ANY Types constant
> cstmt.registerOutParameter(1, Types.XXX);
> cstmt.registerOutParameter(1, Types.XXX, "BOOLEAN");
>
> Does anyone know how to do this?
>
> Thanks!
>
>
> Sent via Deja.com
> http://www.deja.com/
Received on Fri Jan 19 2001 - 22:24:55 CST