Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> OCI - Struct and object

OCI - Struct and object

From: tourneur <tourneur_at_sbgsu42.in2p3.fr>
Date: Wed, 04 Jul 2001 14:34:10 +0200
Message-ID: <3B430D42.7F362321@sbgsu42.in2p3.fr>

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...



4) Now I call OCIDescribeAny(..., "MY_STRUCT", ..., OCI_OTYPE_NAME, OCI_DEFAULT, OCI_PTYPE_TYPE, desc_handle). Here, it returns an error: 'ORA-1403: no data found'.

Then, I've written the rest:
5) a call to OCIAttrGet(desc_handle, OCI_HTYPE_DESCRIBE, &param, ..., 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US