I need to use callable statement for a record table. I know how to pass arguments like string, int etc. You could just write
callableStatement.setString(1, variable);
callableStatement.setInt(2, variable);
But how do I do it for a custom type record list? I can think of creating a struct and somehow sending it but I have no idea about how to do it.
Here’s the custom table and procedures I am going to use
type transaction is record(
trans_id varchar2(20)
,issuer_name varchar2(300)
,location_name varchar2(300)
,trans_date date
,issue_date date);
type transaction_list is table of transaction;
procedure set_transaction
(
caller_id in varchar2
,trans_list in transaction_list
,return_code out varchar2
);
You can’t define a record as a type. You can use OBJECT instead:
And then bind the object in your callable statement to a Struct.