# mco_uda_oid_find
RT

> Search for the object with the specified oid.

### Prototype

        MCO_RET mco_uda_oid_find(	/*IN*/ mco_trans_h t,
                       /*IN*/ mco_uda_value_t * id,
                       /*OUT*/ */ mco_uda_object_handle_t * obj );

### Arguments

t | The transaction handle
id | Address of the`mco_uda_value_t`structure containing the oid to search
obj | The address of a `mco_uda_object_handle_t` struct to receive the UDA object found

### Description

> Searches the database for the object with the specified oid.

### Return Codes

MCO_S_OK | The object with the specified oid was found
MCO_E_UDA_WRONG_VALUE_TYPE | The `id` is not an oid or autooid value
MCO_S_NOTFOUND | No object found with this oid

### Example

        Snippet from schema:

        struct oid_struct {
            uint4 id;
        };

        declare oid oid_struct[10000];

        Application snippet:

        int main(int argc, char** argv)
        {
            MCO_RET rc;
            mco_db_h db;
            mco_trans_h t;
            mco_uda_object_handle_t obj;
            oid an_oid;
            mco_uda_value_t val;
            ...

            an_oid.id = 1001;
            val.type     = MCO_DD_OID;
            val.v.p.p.v    = &an_oid;
            ...
            rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t);
            if ( MCO_S_OK == rc )
            {
                rc = mco_uda_oid_find(t, &val, &obj);

                ...
                rc = mco_trans_rollback(t);
            }
        }

### Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a