howto use ROWNUM which is using in ORACLE??
Posted in 2000
Topics: General Discussion
..I want to know how to use ROWNUM or similar thing in Informix... In manual site, I already figure out that informix doesn't have ROWNUM ... .Isn't there another way..??
On Tue, 2 May 2000 10:52:52 +0900, "batti" <batti@digito.com> wrote: >..I want to know how to use ROWNUM or similar thing in Informix... > >In manual site, I already figure out that informix doesn't have ROWNUM ... > >.Isn't there another way..?? > > It is rowid in Informix. Vivek Chaudhary
batti wrote: > > ..I want to know how to use ROWNUM or similar thing in Informix... > > In manual site, I already figure out that informix doesn't have ROWNUM ... > > .Isn't there another way..?? You can use ROWID, the equivalent hidden internal identifier for a row. However, there are several gotchas with rowids: o ROWID for non-fragmented tables are the physical address of the row within the table representing the page number the row resides on and its slot number (relative order) on the page. If you unload and reload a table or otherwise reorganize the table the rowid of a particular row WILL change so you CANNOT use rowid as a foreign key in a related table. Also, unlike Oracle ROWNUM, ROWID has nothing to do with the order in which rows were added to the table. o Fragmented tables do NOT have ROWID unless the table was EXPLICITELY created with rowids included (the WITH ROWID clause) which actually adds an indexed unique column to the table which is not normally returned. Again reorganizing the table will change the ROWID hidden column value. It is NOT recommended to use rowids in queries except in VERY short term sequences of operations, and even then the practice is discouraged. Why don't you tell us what it is you would use Oracle ROWNUM for in your application and we will recommend the Informix paradigm for how to best accomplish this. Art S. Kagel