Tuesday, May 03, 2011


Oracle OCI Tips

If OCIDirPathPrepare fails with ORA-01403, check and make sure that the OCI_ATTR_SCHEMA_NAME attribute has been set on the OCIDirPathCtx handle.

If OCIDirPathColArrayToStream fails with ORA-12899, you're probably not passing in the rowcnt and rowoff values correctly. The docs aren't very clear on how to specify those two parameters, so I'll try to elaborate here a little bit:

  • rowcnt should always be the number of rows that have been set in the column array, including rows that have already been sent to the stream buffer. A column array's set rows don't get cleared until you call OCIDirPathColArrayReset. If you specify a rowcnt that is too large (i.e. it includes unset rows), you may encounter errors.
  • rowoff should be the row index into the column array where stream conversion should begin.
If you follow these guidelines, OCIDirPathColArrayToStream will process rowcnt - rowoff rows during the conversion.

For example, let's suppose that you've previously converted three rows of a column array to the stream. You have just added a fourth row to the column array, and now you want to add that new row to the stream. Set rowcnt to 4, since that's the total number of rows that have been specified in the column array. Set rowoff to 3, since you've already converted rows 0, 1, and 2.


Release 7.0; Copyright © 1996-2012 Aaron Klotz. All Rights Reserved.