Re: Reversal of Records (fwd)
Posted in 1991
>
> OK people, my turn. Nobody has yet mentioned VIEWS. Why can't you set
> up a view of the form
>
> CREATE VIEW viewtab AS
> SELECT * FROM tab
> ORDER BY serial>
> You can then use this view in Perform for both inserting and retrieving,
> and of course it will also work for reports.
>
> Tell me why not?
>
> Tony Lacy-Thompson
> DB Product Manager, Informix UK
> Author of "INFORMIX-SQL, a Tutorial and Reference"
>
> MAIL: tonylt@informix.co.uk
> UUCP: ...!uunet!infmx!asterix!tonylt
Tony -
This should work fine as long as there is only one user (multiple
simultaneous users would cause interleaved serial numbers).
While this is a fine short term fix, it is not a good general,
long term solution. The SERIAL type is not guaranteed to be
ordered in any particular way any more than ROWID is - it just
happens to be ordered in the current version of the product. Just
as the characteristics of ROWID changed in the transition from
STANDARD ENGINE to ONLINE, there is a real possibility that this
characteristic of SERIAL might change in a future product.
The reason for this is the reason that SERIAL exists - it provides
an automatically generated primary key. The only implied
requirements are that a type SERIAL be UNIQUE and NOT NULL.
In addition, a quick review of several Informix 4.0 manuals
indicates that there is no promise made there about ordering
of type SERIAL with respect to INSERT sequence.
All of this leads me to believe that if it is technically
convenient to change the ordering of type SERIAL in a future
release, that it might just happen. (One way around this
would be to set the value of the SERIAL column on INSERT,
thus bypassing the automatic mechanism for assigning the
value - if you do this, however, you might as well use
an INTEGER).
Again, I think your solution is a good short term fix - from
what I can see, this is a single user application.
As I indicated in an earlier posting, a good, long term solution
is to include a column that reflects the logically required order.
If there were multiple users, this might need to consist of two
columns, one to identify a group entered records, and the second
to indicate the order within that group.
------------ DHL WORLDWIDE EXPRESS -------------------------------------------
Greg Bryan gbryan@ssf-sys.dhl.com DHL Systems
Data Administrator uunet!ssf-sys.dhl.com!gbryan San Francisco
-------------------------------------------------------------------------------