# dbname_delete_object

> This function deletes a database object (referenced by its OID).

### Prototype

>         MCO_RET	dbname_delete_object( /*IN*/ mco_trans_h trans,
>                             /*IN*/ const dbname_oid *oid);

### Arguments

trans | A transaction handle returned by `mco_trans_start()`
oid | A pointer to an instance of the generated typedef `dbname_oid`, which contains the OID of the object to be deleted

### Description

> This function will remove the object referenced by the OID, and all the object’s versions, from the database. Hash and tree index entries, if any, will also be removed. The transaction, trans, must be a `MCO_READ_WRITE` transaction.

### Return Codes

MCO_S_OK | The object was deleted successfully
MCO_S_NOTFOUND | There are no objects referenced by the OID given
MCO_E_ACCESS | Transaction must be `READ_WRITE`
MCO_E_DELETED | The object is deleted already
MCO_E_NOMEM |
MCO_ERR_COMMON |
MCO_ERR_OBJECT_HANDLE |
MCO_ERR_TRN |
MCO_ERR_TRN_LONG |

Related Topics