private object ExecuteScalarInternal(bool needCLStype, bool needRowid, out OciRowidDescriptor rowidDescriptor)
        {
            OciStatementHandle statementHandle = null;
            object             oracleValue     = null;
            int rc = 0;

            try
            {
                statementHandle = this.GetStatementHandle();
                ArrayList resultParameterOrdinals = new ArrayList();
                this.Execute(statementHandle, CommandBehavior.Default, needRowid, out rowidDescriptor, out resultParameterOrdinals);
                if (OCI.STMT.OCI_STMT_SELECT != this._statementType)
                {
                    return(oracleValue);
                }
                OracleColumn column       = new OracleColumn(statementHandle, 0, this.ErrorHandle, this._connection);
                int          offset       = 0;
                bool         success      = false;
                bool         mustRelease  = false;
                SafeHandle   handleToBind = null;
                column.Describe(ref offset, this._connection, this.ErrorHandle);
                NativeBuffer_RowBuffer buffer = new NativeBuffer_RowBuffer(offset, 1);
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                    buffer.DangerousAddRef(ref success);
                    column.Bind(statementHandle, buffer, this.ErrorHandle, 0);
                    column.Rebind(this._connection, ref mustRelease, ref handleToBind);
                    rc = TracedNativeMethods.OCIStmtFetch(statementHandle, this.ErrorHandle, 1, OCI.FETCH.OCI_FETCH_NEXT, OCI.MODE.OCI_DEFAULT);
                    if (100 != rc)
                    {
                        if (rc != 0)
                        {
                            this.Connection.CheckError(this.ErrorHandle, rc);
                        }
                        if (needCLStype)
                        {
                            oracleValue = column.GetValue(buffer);
                        }
                        else
                        {
                            oracleValue = column.GetOracleValue(buffer);
                        }
                    }
                }
                finally
                {
                    if (mustRelease)
                    {
                        handleToBind.DangerousRelease();
                    }
                    if (success)
                    {
                        buffer.DangerousRelease();
                    }
                }
                GC.KeepAlive(column);
            }
            finally
            {
                if (statementHandle != null)
                {
                    this.ReleaseStatementHandle(statementHandle);
                }
            }
            return(oracleValue);
        }