/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2012 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

  CREATE OR REPLACE FORCE VIEW xxas_tcm_log_entry_states_v
  AS
  SELECT xtle.log_entry_id
  ,      xtle.assignment_id
  ,      xtle.person_id
  ,      xtle.start_date_time
  ,      xtle.end_date_time
  ,      xtle.element_type_id
  ,      xtle.duration_hours
  ,      xtle.field1
  ,      xtle.field2
  ,      xtle.field3
  ,      xtle.field4
  ,      xtle.field5
  ,      xtle.cost_allocation_keyflex_id
  ,      xtle.override_approver_role
  ,      xtle.log_entry_details
  ,      xtle.period_id
  ,      xtle.period_name
  ,      xtle.period_start_date
  ,      xtle.period_end_date
  ,      xtle.period_late_start
  ,      xtle.period_early_finish
  ,      xtle.log_entry_last_updated_by
  ,      xcd.current_state_code        
  ,      xcd.current_state
  ,      xcd.current_ins_upd_del
  ,      xcd.internal_data_id      
  ,      xcd.data_id
  ,      xcd.data_type
  ,      xcd.comments
  FROM   xxas_tcm_log_entries_v xtle
  ,      xxas_com_data_v        xcd
  WHERE  xtle.log_entry_id = xcd.data_id
  AND    xcd.data_type     = 1;

COMMIT;
EXIT;
