go-goracle / goracle

Go database/sql driver for connecting to Oracle Database, using the ODPI-C library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boolean out parameter not working

rafaelmdbr opened this issue · comments

I have tried to get the value of boolean output parameters from procedure calls, but it is not working. When I call procedures that return record types, integers or strings, they work fine.

PROCEDURE pr_validar_processo_comprot(
              wp_num_proc            IN  VARCHAR2,
              wp_out_cod_retorno     OUT BOOLEAN);
var v bool
params := []interface{}{
    sql.Named("nr", numProcessoHab), // numProcessoHab is a string param
    sql.Named("v", sql.Out{Dest: &v}),
}
sql :=
    `begin
	pk_judi_fachada_usuario.pr_validar_processo_comprot(:nr, :v);
     end;`
_, err = conn.ExecContext(ctx, sql, params...)

Then I get the following error:

dpiStmt_execute(mode=32 arrLen=-1): ORA-06502: PL/SQL: numeric or value error ORA-06512: at line 2
Are Oracle PL Boolean types supported by Goracle/ODPI-C?

FWIW my general recommendation is to not bind PL/SQL booleans unless both Oracle DB and the Oracle client libraries are 12.2 or later. However, if you have a homogeneous operating system environment you should be fine with earlier versions.

0f28437 fixed an issue, but it works only if client and server is both at least 12.2 (18c in the new parlance).