> Naveen, > > There is no way to do what you want directly in SQL. You are looking for an > INSERT OR UPDATE type of functionality, this does not exist in SQL. > > Your program can retrieve the rowid of a conflicting insert by doing a select > before the insert. If there is a conflicting record then it can be deleted, > and > a new record with the same rowid value can then be inserted. You can wrap > this > series of SQL statements in a transaction to make it atomic. > > do begin > conflicting_row = do select rowid from t where <conflict condition> > if conflicting_row > do delete from t where rowid = conflicting_row > do insert into t(rowid, ...) values(conflicting_row, ...) > do commit > > After this sequence, the correct value will be returned by > last_insert_rowid(). > > HTH > Dennis Cote
Dennis, Thanks for the information. This is exactly what I needed and works as expected. - Naveen Nathan