# classname_fieldname_insert

This function inserts the supplied values into the sequence.

### Prototype

>         MCO_RET	classname_fieldname_insert(	/*IN*/ classname *handle,
>                                 /*IN*/ mco_seq_no_t pos,
>                                 /*IN*/ TYPE *values,
>                                 /*IN*/ mco_size_t n_items );

### Arguments

handle | A pointer to a classname handle
pos | The position number (zero-based) where values are to be inserted
values | A pointer to the values to be inserted into the sequence
n_items | The number of elements to be inserted from `values` to the sequence

### Description

This function applies to sequence fields. The supplied values are inserted into the sequence at position `pos`.

### Return Codes

MCO_S_OK | The value was put successfully
MCO_E_ACCESS | The transaction that the class handle is scoped to is `MCO_READ_ONLY`

Related Topics

## Example

        #define  DAY_THREE              3
        #define  DAY_THREE_PRICE        30
        uint4 day_to_insert[1] = { DAY_THREE };
        float price_to_insert[1] = { DAY_THREE_PRICE };
        ...
        mco_trans_h     t;
        mco_cursor_t    cur;
        ...
        mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &t);
        rc = Quote_by_symbol_index_cursor(t, &cur);
        if (MCO_S_OK == rc)
        {
            rc = Quote_by_symbol_search(t, &cur, MCO_GE, "IBM",
                            (uint2)(sizeof("IBM")));
            if (MCO_S_OK == rc)
            {
                //insert here
                Quote q;
                Quote_new(t, &q);

                rc = Quote_from_cursor(t, &cur, &q);
                rc = Quote_day_iterator(&q, &it);
                if (MCO_S_OK == rc)
                {
                    rc = Quote_day_search(&q, &it,
                                DAY_THREE, MCO_SEQ_BOUNDARY_EXCLUSIVE,
                                0, MCO_SEQ_BOUNDARY_OPEN);
                    mco_seq_no_t pos = it.first_seq_no;
                    rc = Quote_day_insert(&q, pos, day_to_insert, 1);
                    rc = Quote_price_insert(&q, pos, price_to_insert, 1);
                    rc = mco_trans_commit(t);
                }
            }
        }