|
Как написать update
|
|||
---|---|---|---|
#18+
Помогите дописать update Код: plsql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19.
Код: plsql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.
... |
|||
:
Нравится:
Не нравится:
|
|||
17.01.2017, 10:56 |
|
Как написать update
|
|||
---|---|---|---|
#18+
Второй результат отличается от первого то, что в time_to любая запись, это следующая запись из time_to. ... |
|||
:
Нравится:
Не нравится:
|
|||
17.01.2017, 12:35 |
|
Как написать update
|
|||
---|---|---|---|
#18+
Попробуй так BEGIN WORK; -- Создание курсора: DECLARE cursors01 SCROLL CURSOR FOR SELECT * FROM templ.sat_subject_attrs sat_subj where subj_id = 429230; -- Получение следующей строки через курсор FETCH next FROM cursors01 INTO cursors02 update templ.sat_subject_attrs sat_subj set time_to = (case when cursors01.time_from is not null then cursors01.time_from else '9999-12-31 00:00:00' end) WHERE CURRENT OF FETCH last FROM cursors01; CLOSE cursors01; COMMIT WORK; ... |
|||
:
Нравится:
Не нравится:
|
|||
17.01.2017, 13:47 |
|
Как написать update
|
|||
---|---|---|---|
#18+
Или так Update templ.sat_subject_attrs sat_subj set time_to= ( select max(time_to_new) from ( select ssa.ctid, ssa.time_from, coalesce(lead (ssa.time_from, 1) over( partition by ssa.subj_id order by ssa.time_from asc), to_Date('9999-12-31 00:00:00', 'YYYY-MM_DD HH24:MI:SS')) as time_to_new from templ.sat_subject_attrs ssa where ssa.subj_id=429230 )sat_subj_new where sat_subj_new.ctid = '' || sat_subj.ctid || ''::tid and sat_subj_new.time_from=sat_subj.time_from ) where sat_subj.subj_id=429230 ... |
|||
:
Нравится:
Не нравится:
|
|||
17.01.2017, 15:28 |
|
|
start [/forum/topic.php?fid=53&fpage=79&tid=1996752]: |
0ms |
get settings: |
10ms |
get forum list: |
14ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
35ms |
get topic data: |
11ms |
get forum data: |
2ms |
get page messages: |
92ms |
get tp. blocked users: |
2ms |
others: | 347ms |
total: | 519ms |
0 / 0 |