CREATE OR REPLACE VIEW V_CURRENT_DOCUMENT_STATUS AS
SELECT docu_id
      ,event_date
      ,dost_code
  FROM (SELECT docu_id
              ,event_date
              ,dost_code
              ,id
              ,MAX(id) over(PARTITION BY docu_id) AS max_id
          FROM document_events)
 WHERE id = max_id
;
