Share this page

# lrd_stmt

Sets an SQL statement to be processed.

    LRDRET lrd_stmt( LRD_CURSOR *mptCursor, char *mpcText, long mliTextLen, LRDOS_INT4 mjOpt1, LRDOS_INT4 mjOpt2, int miDBErrorSeverity );

mptCursor | A pointer to an LRD_CURSOR structure.
mpcText | A pointer to SQL statement text.
mliTextLen | The length of the text, or -1 to take the full length of a null terminated string.
mjOpt1 | A database-dependent statement option, Option 1
mjOpt2 | A database-dependent statement option, Option 2
miDBErrorSeverity | The Error Severity Levels of a failure in a database routine.

The lrd_stmt function associates a character string (usually an SQL statement) with a cursor.

Note that when working with ODBC, you can specify direct execution by setting mjOpt1 to 1.

The lrd_exec function resets the contents of the SQL statement set by lrd_stmt; you must provide a new SQL statement after every lrd_exec function call.

For more details refer to the Function Header File lrd.h in the include directory.

## Return Values

See LRD Return Values.

## Parameterization

The following argument can be parameterized using standard parameterization: mpcValStr

## Example

In the following example, lrd_stmt sets a SELECT statement to retrieve all database records that contain a value of 1000 or greater in their SAL column.

     /* Set up and execute the SQL statement.*/

    lr_think_time(76);

    lrd_stmt(Csr1, "select ename from emp where (sal>=1000)\n", -1, 1, 1, 0);

    lrd_bind_col(Csr1, 1, &D21_ENAME, 0);

    lrd_exec(Csr1, 0, 0, 0, 0);

    lrd_fetch(Csr1, -3, 1, 0, PrintRow24, 0);

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: