Oracle Solution for Error ora-39766

Solution for Oracle Error ORA-39766

ORA-39766: invaid stream specified for column array conversion

What triggered the Error:

A stream must be loaded and reset before used again in a column-array-to-stream conversion. This error is issued if another stream has subsequently been converted before the specified stream has been loaded, or if the latest load of this stream returned OCI_ERROR.

What should we do to fix it:

Don't convert into a previous stream before it is loaded. Also, when load stream returns OCI_ERROR, the stream must be loaded again to insure any remaining information in the stream is loaded. The stream must be loaded even if the last or only row was in error. There may be error information in the stream that needs to be sent to the server.