Share this page

# lrd_save_last_rowid

Saves a rowid value to a parameter. (Oracle only)

    LRDRET lrd_save_last_rowid( LRD_CURSOR *mptCursor, char *mpszParamName );

mptCursor | A pointer to an LRD_CURSOR structure.
mpszParamName | A parameter name using alpha-numerical characters, enclosed by quotation marks.

The lrd_save_last_rowid function saves the rowid of the last row of the current result set, to a parameter. The last rowid value can be used at a later point in the script.

Note that lrd_fetch should be called prior to lrd_save_last_rowid.

## Return Values

See LRD Return Values.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, the lrd_save_last_rowid function saves a rowid to a parameter and retrieves the salary of the last employee.

     /* Recorded script */

    lrd_stmt(Csr1, "select id from employees where name='John'", ...);

    lrd_bind_col(Csr1,...);

    lrd_exec(Csr1, ...);

    lrd_fetch(Csr1, 1,...);

    lrd_stmt(Csr1, "select salary from payment where id='777' ",...);

    lrd_exec(Csr1, ...);

     / * Modified script */

    lrd_stmt(Csr1, "select id from employees where name='John'", ...);

    lrd_bind_col(Csr1,...);

    lrd_exec(Csr1, ...);

    /* Call lrd_fetch prior to lrd_save_last_rowid */

    lrd_fetch(Csr1, 1, ...);

    lrd_save_last_rowid(Csr1,"last_row_id");

    lrd_stmt(Csr1, "select salary from payment where rowid='{last_row_id}' ", ...);

    lrd_exec(Csr1, ...);

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: