SELECT X.ID, X.SECURITY_ID, X.DATE_AND_TIME, X.PRICE FROM (
SELECT CASE WHEN NEXT_VALUE = 0 THEN 1
WHEN NEXT_VALUE = PRICE THEN 0
ELSE 1 END AS CHECK_VALUE, A.* FROM (
SELECT A.*,LEAD(A.PRICE, 1, 0) OVER(ORDER BY ID) NEXT_VALUE FROM
TAB A ) A ) X WHERE CHECK_VALUE = 1 ORDER BY ID