I have a stored procedure that is generating a random float number as an ID marker, and as soon as it is called it stores the random number + .1 into a history/logging table, and then the end result is stored with the same random number +.2 (as a sequencer/sorter).
Is there an easy way to dynamiclly query a column filled with these sequence numbers (as exampled below) and to verify there are an even number of them (pairs) in order to easily make sure that the stored procedure has always processed properly?
1568.1
1568.2
8452.1
8452.2
9886.1
9886.2
5455.1
3682.1
3682.2
4857.1
4857.2
In the sample data above I would like a query that alerts to the presence of 5455.1 as it does not have a second part (5455.2) which it always should have as my stored procedure logs a second entry with the results of the call (success or failure).
Of course, I need it to not only alert me that the problem/oddball exists (as I could simply run a count on the table and see if the number is even to determine that), I would like to be able to select the mismatches so I am not sorting through 10,000 lines of history/logs to find the one that does not have a partner.
First, your ID-Key should not be one column, it should be two. That is, instead of
You should have something like:
Assuming this then and additionally that the specific anomaly that you are looking for is an ID with {Phase=1) but no corresponding {Phase=2} this one way to write the query: