Jika versi Oracle Anda mendukung LAG
maka ada opsi mudah:
SELECT
id,
CASE WHEN value >= LAG(value, 1, value) OVER (PARTITION BY name ORDER BY meas_date)
THEN 0 ELSE 1 END AS flag
FROM yourTable
Jika versi Oracle Anda mendukung LAG
maka ada opsi mudah:
SELECT
id,
CASE WHEN value >= LAG(value, 1, value) OVER (PARTITION BY name ORDER BY meas_date)
THEN 0 ELSE 1 END AS flag
FROM yourTable