 If writing data in single pieces, then make sure that the buffer length specified is big enough to accommodate the data being provided. If data is written in pieces, then make sure that all the data has been provided before specifying OCI_LAST_PIECE.