I executed Following SQL in Multiple sessions, insert into mse9csd.ATS_REQUEST_IDS@mse9lnk s (S.SERIAL_NO, S.Request_id) values (((Select max(SERIAL_NO) from ATS_REQUEST_IDS)+1),'B'); I got duplicate entries in the table, could it be happened ?
i am maintaining a MSSQL database, with a stored procedure which pulls records within a certain timeframe and then outputs a table of grouped totals from this data
the part of setting the min and max date range works fine, but i need to be able to completely scrap all the records unless the end date has been reached. problem is, the records only have a field recording the movement date, and have no knowledge of the actual finish date
You could try to use the analytic "lead" function. Then select where the lead column is not null. So for instance: select movementDate, LEAD(movementDate) OVER (ORDER BY MovementDate ) LeadValue FROM table WHERE LeadValue IS NOT NULL; (this will remove the most recent value that has not been closed.