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

Help with calling PL/SQL Proc object as input

bouceka opened this issue · comments

Hello, i'm asking for help I don't know what type i need to declared when parametr is reference of other table. (in line where is "a_mcalist_i IN tsip_mca_list_type"). Because i declared here (var a_mcalist_i goracle.Object) and i got this error panic: 4: newVar(typ=2023, natTyp=3009, sliceLen=1, bufSize=0): ORA-00000: DPI-1025: no object type specified for object variable
Thank you for help and have a nice day :-)

i have PL/SQL procedure:

PROCEDURE getSum
(
p_operation_id IN OUT VARCHAR2,
a_languagecode_i IN VARCHAR2,
a_username_i IN VARCHAR2,
a_channelcode_i IN VARCHAR2,
a_mcalist_i IN tsip_mca_list_type,
a_validfrom_i IN DATE,
a_validto_i IN DATE,
a_statuscode_list_i IN VARCHAR2 ,
a_type_list_o OUT SYS_REFCURSOR
);

create or replace TYPE tsip_mca_list_type FORCE AS TABLE OF tsip_mca_type;
create or replace TYPE tsip_mca_type FORCE AS OBJECT (

numberpart1 VARCHAR2(6),
numberpart2 VARCHAR2(10),
code VARCHAR(7),

CONSTRUCTOR FUNCTION tsip_mca_type
RETURN SELF AS RESULT
)

Golang code:

var p_operation_id string
var a_languagecode_i string
var a_username_i string
var a_channelcode_i string
var a_mcalist_i goracle.Object
var a_validfrom_i string
var a_validto_i string
var a_statuscode_list_i string
var a_type_list_o driver.Rows

_, err = db.Exec('BEGIN PACKAGE1.GETSUM(:v1,:v2,:v3,:v4,:v5,:v6,:v7,:v8,:v9); END;',
sql.Named("v1", sql.Out{Dest: &p_operation_id, In: true}),
sql.Named("v2", &a_languagecode_i),
sql.Named("v3", &a_username_i),
sql.Named("v4", &a_channelcode_i),
sql.Named("v5",&a_mcalist_i),
sql.Named("v6", &a_validfrom_i),
sql.Named("v7", &a_validto_i),
sql.Named("v8", &a_statuscode_list_i),
sql.Named("v9", sql.Out{Dest: &a_type_list_o}),

Check TestCallWithObject in z_plsql_types_test.go in 50223f2 !