Re: rowid no longer unique?
Posted in 1996
Ron wrote:
>
> I think I remember seeing something in this bb about rowid no longer being
> necessarily unique within a table for v7. Is this true? More than once,
> while coding with ESQL, I coded a singleton select that I knew would return
> more than one row so I just added a where clause to avoid opening a cursor:
>
> select col from tab where rowid =
> (select max(rowid) from tab where key = "somevalue")
Well, Not being a purist, I would consider a cursor.
If you frag a table for pdq, rowid is not unique.
IMHO, if you are going to write code, write it so that it is
maintainable. Rowid is no longer a *guaranteed* method of selecting a
single row.
Now for $.02 worth, heres another tip from your uncle mike:
Use a cursor and have the select statement do an order by so that
your first row is the row you want.
Declare the cursor.
Open the cursor.
fetch the row.
Close the cursor.
Go one with your program or Free the cursor.
If this select statment is being used multiple times, it is better
to use a cursor. If this statement is being used in one part of the
program and is used infrequently, use a cursor since the overhead
is minimal.
-Mike