| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> calling PL/SQL func with OUT parameter from OCI
Hi all,
I'm trying to call a PL/SQL function within an OCI application using Oracle8.1.7.
The C client application calls a PL/SQL function which return an object.
The returned object type (CUSTOMERINFO) has 2 attributes: 1 varchar2 (ID) + 1 varray (VARR_INFO) of object INFO.
create or replace type INFO as object (
attrib VARCHAR2(256),
value VARCHAR2(256)
);
create or replace type VARR_INFO as varray(12) of INFO;
create or replace type CUSTOMERINFO as object (
id VARCHAR2(20), listParams VARR_INFO
Function testfunc (id varchar2) return CUSTOMERINFO as
resultset_info CUSTOMERINFO;
begin
resultset_info :=CUSTOMERINFO(
'id',
VARR_INFO (
INFO( 'attrib1', 'value1'),
INFO( 'attrib2', 'value2')
)
return resultset_info;
end testfunc;
/*
statement used to call the stored function:
"BEGIN \
:customerinfo := testfunc(:sessionId);\
END;";
*/
OCIBindByName for the :sessionId IN parameter
OCIBindByName for the :customerinfo return object
OCITypeByName for the type CUSTOMERINFO
OCIBindObject for the :customerinfo.
OCIStmtExecute.
The statement is succesfully executed but I can only manage to access the ID attribute (varchar2) of the returned CUSTOMERINFO object not the varray attribute (LISTPARAMS) of the same object.
I've tried to read this attribute using iterators but it does not work causing the application to abort when calling OCICollSize or OCIIterNext.
I've searched through the Oracle application development manuals and
the web
but I could not find some clean example illustrating the way to do it.
How can I read the varray attribute of the returned struct ?
Can you please help?
Thanks,
Sasfi.
Received on Fri Aug 23 2002 - 03:14:35 CDT
![]() |
![]() |