select (mod(emp_id,5)-emp_id)*-1 page, seq_no,tutar FROM (
SELECT seq_no, tutar, ROW_NUMBER()
OVER (PARTITION BY seq_no ORDER BY seq_no) AS emp_id
FROM ser_hiz_det
where seq_no in ('680501','81127')
)
ORDER BY seq_no
SELECT department_id, last_name, employee_id, ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY employee_id) AS emp_id FROM employees; DEPARTMENT_ID LAST_NAME EMPLOYEE_ID EMP_ID ------------- ------------------------- ----------- ---------- 10 Whalen 200 1 20 Hartstein 201 1 20 Fay 202 2 30 Raphaely 114 1 30 Khoo 115 2 30 Baida 116 3 30 Tobias 117 4 30 Himuro 118 5 30 Colmenares 119 6 40 Mavris 203 1 . . . 100 Popp 113 6 110 Higgins 205 1 110 Gietz 206 2