Description of the illustration lnoci026.eps

This illustration shows how the piecewise fetch process works. The illustration shows a center row of stacked rectangular shaped boxes. The top box is labelled “execute statement OCISTMTExecute()” and indicates this API initializes the OCI environment, allocates necessary handles, connects to a database, authorizes a user, prepares a statement, and executes the statement. A downward arrow from that box points to a box labelled “define OCIDefineByPos()” indicating you call OCIDefineByPos() to define an output variable with mode set to OCI_DYNAMIC_FETCH. At this point you do not need to specify the actual size of the pieces you use, but you must provide the total size of the data that is to be fetched at run time. A downward arrow points from that box to a box labelled “Fetch OCIStmtFetch()” indicating you call OCIStmtFetch2() for the first time. A box to the left is labelled “get piece info OCIStmtGetPieceInfo()” indicating if no data is retrieved and the OCI_NEED_DATA error code is returned to the application, call OCIStmtGetPieceInfo(); otherwise, if any other value is returned, then an error occurred. An upward arrorw pointing from that box to a box labelled “set piece info OCIStmtSetPieceInfo()” indicates you call OCIStmtSetPieceInfo() to obtain information about the piece to be fetched. The piecep parameter indicates whether it is the first piece (OCI_FIRST_PIECE), a subsequent piece (OCI_NEXT_PIECE), or the last piece (OCI_LAST_PIECE). Call OCIStmtSetPieceInfo() to specify the fetch buffer. An arrow pointing to the right of that box to the box labelled “Fetch OCIStmtFetch()” indicates you call OCIStmtFetch2() again to retrieve the actual piece. If OCIStmtFetch2() returns OCI_SUCCESS, all the pieces have been fetched successfully. If OCIStmtFetch2() returns OCI_NEED_DATA, then call OCIStmtGetPieceInfo() to process the next piece. If any other value is returned, an error occurred.