× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Unless I misunderstood the "requirements" you could do something like this, using STRSQL or Run SQL Scripts or equivalent:

Suppose you have this table:
CREATE TABLE ORDERS
(ORDERNO INTEGER NOT NULL
GENERATED ALWAYS AS IDENTITY
(START WITH 500
INCREMENT BY 1
CYCLE),
SHIPPED_TO VARCHAR (36) ,
ORDER_DATE DATE)
Then do an INSERT like this:

INSERT INTO ORDERS (SHIPPED_TO, ORDER_DATE)         
    VALUES('My Sample Company', '2019-05-24' )


Next, run this query to see what was just inserted (to determine the "next number" value just used):

    SELECT * FROM ORDERS WHERE ORDER_DATE = '2019-05-24'


Now, suppose you see this result:

 ORDERNO   SHIPPED_TO                            ORDER_DATE
     536   My Sample Company                      05/24/19



Now, you know that the "next number" should be > 536 ...


Run this query to determine if there are any "pending conflicts" ...

    SELECT * FROM ORDERS WHERE ORDERNO > 536


Examine the results; that should indicate whether there is any potential trouble lurking ...   
(Ideally, no rows should be returned.)


Preferably, do this during "off-peak hours" when no one else is updating that table actively.


It might also be nice to also "clean up" after, by deleting the "dummy" row inserted:


    DELETE FROM ORDERS WHERE ORDERNO = 536


No need for embedded SQL, unless you want to develop a tool to automate this process.

Does that help?


Mark S. Waterbury



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.