Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: selecting a record based on row id
Użytkownik "Jon Schlatter" <*jon-schlatter_at_stamats.com> napisał w wiadomości
news:tp9qvsj0jvv5c4_at_corp.supernews.com...
> Is there a SQL Plus/PLSQL command to select a record based on row id? I
have
> a table which has a single records with malformed data. The tables
contains
> 140,000 records so it is difficult to review manually, but I know that
> record 63,873 has the bad data. How can I view/change just that record
> without knowing what specific data it contains.
Just add column and fill it from a sequence.
ALTER TABLE <Your_Table> ADD record_no NUMBER;
CREATE SEQUENCE S_TMP;
UPDATE <Your Table> SET record_no = s_tmp.NextVal;
COMMIT;
DROP SEQUENCE S_TMP;
SELECT * FROM Your_Table WHERE record_no = 63873;
If you store a ROWID of a row, you can find it by that value, but using rownum you fail.
SELECT * FROM Your_Table WHERE rownum = 63873 returns no rows.
You can of corse SELECT <data>, rownum FROM Your_Table and browse results until rownum = 63873....
PS.
Rowid looks like this.
example:
AAAOb8AASAABlRgAAA
![]() |
![]() |