Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> OCI - Struct and object
Hi!
I'm trying to get a structure from Oracle8i DB with a package procedure,
but it seems not to be working. I've declared my structure as an object:
CREATE TYPE my_struct AS OBJECT (
txt VARCHAR(30),
val FLOAT
);
Then, I try to make everything work in OCI:
1) I first call to OCIStmtPrepare(..., "BEGIN my_pkg.my_procedure(:id,
:line); END;", ...). The id variable selects a row in a table. The
procedure then returns elements read from this row into line, which is
THE structure.
2) Then, I call OCIBindByName two times, to bind id and line (of type
SQLT_NTY) with C vars, which have the same names. By the way, it's no
more necessary to define line as it's already bind (I think. Am I
wrong?).
3) Then, I call OCITypeByName(..., "MY_STRUCT", ..., &my_tdo). This
seems to be fine, but...
Then, I've written the rest:
5) a call to OCIAttrGet(desc_handle, OCI_HTYPE_DESCRIBE, ¶m, ...,
OCI_ATTR_PARAM, ...),
6) followed by a call to OCIAttrGet(param, OCI_DTYPE_PARAM, &type_ref,
..., OCI_ATTR_REF_TDO, ...),
7) and a call to OCIObjectPin(..., type_ref, ..., OCI_PIN_ANY,
OCI_DURATION_SESSION, OCI_LOCK_NONE, &my_tdo),
8) and a call to OCIBindObject(..., my_tdo, &line, ..., &line_ind),
9) and finally I call OCIStmtExec...
I initialized OCI with OCI_OBJECT.
If you know how I can solve the error above or if there's something that could be wrong anywhere, thank you!
Thibaud Received on Wed Jul 04 2001 - 07:34:10 CDT
![]() |
![]() |