lrd_ora8_save_last_rowid
Saves a rowid value to a parameter. (Oracle only)
LRDRET lrd_ora8_save_last_rowid( void *mpvLRDDBIHandleStmt,
const char *mpszParamName );
| mpvLRDDBIHandleStmt | A non-NULL pointer to an LRDDBI Statement Handle. |
| mpszParamName | A parameter name using alpha-numerical characters, enclosed by quotation marks. |
The lrd_ora8_save_last_rowid function saves the rowid of the last row of the current result set to a parameter.
Note that lrd_ora8_save_last_rowid can be used after a SELECT FOR UPDATE query, but not after a regular SELECT query.
Return Values
See LRD Return Values.
Parameterization
You cannot use standard parameterization for any arguments in this function.
Example
In the following example lrd_ora8_save_last_rowid saves the rowid of the new employee record that was inserted. Afterwards this employee record is updated by using the saved rowid.
/* Recorded script */
lrd_ora8_stmt(OraStm1, "insert into employees values('77', 60)", ...);lrd_ora8_exec(OraSvc1, OraStm1, ...);
lrd_ora8_stmt(OraStm1,
"update employees set salary = 70 where rowid = 'AAAHT5AABAAAIXUAAA'", ...);
lrd_ora8_exec(OraSvc1, OraStm1, ...);
/* Modified script */
lrd_ora8_stmt(OraStm1, "insert into employees values('77', 60)", ...);lrd_ora8_exec(OraSvc1, OraStm1, ...);
lrd_ora8_save_last_rowid(OraStm1, "last_row_id");
lrd_ora8_stmt(OraStm1,
"update employees set salary = 70 where rowid = '{last_row_id}'",
...);lrd_ora8_exec(OraSvc1, OraStm1, ...);

