Example: lr_param_increment

The following code snippet illustrates lr_param_increment being used to increment the value of a parameter modification_num, and storing the incremented value as a new parameter, next_modnum.

This new parameter is assigned to the ":1" placeholder within an Oracle statement using lrd_assign(). The statement is then executed using the lrd_ora8_exec function.

/* Get value of modification_num from Oracle database */
lrd_ora8_save_col(OraStm142, 9, 1, 0, "modification_num");
/* modification_num = "194128" */

lrd_ora8_fetch(OraStm142, -1, 408, &uliFetchedRows, PrintRow52, 2, 0, 1);

/* Increment modification_num and store it as "next_modnum" */
lr_param_increment("next_modnum", "{modification_num}");
/* next_modnum was "194129" during recording. */

lrd_ora8_stmt(OraStm143, "\nUPDATE S_SSA_ID SET\n "
       "NEXT_SUFFIX = 'ABCDE',\n MODIFICATION_NUM = :1\n "
       " WHERE\n MODIFICATION_NUM = :2\n", 1, 0, 0);

/* Assign the new incremented value of next_modnumto the statement */
lrd_assign(&P1D1062, "{next_modnum}", 0, 0, 0);
lrd_ora8_bind_placeholder(OraStm143, &OraBnd496, "1", &P1D1062,
LRD_BIND_BY_POS, 0, 0);

lrd_assign(&P2D1063, "{modification_num}", 0, 0, 0);
lrd_ora8_bind_placeholder(OraStm143, &OraBnd497, "2", &P2D1063,
LRD_BIND_BY_POS, 0, 0);
lrd_ora8_exec(OraSvc6, OraStm143, 1, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);