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

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

DECLARE
  e_obj_not_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_obj_not_exists, -04043);
BEGIN

  BEGIN
    EXECUTE IMMEDIATE 'DROP TYPE XXAS_COM_PER_CONTACT_VARRAY FORCE';
  EXCEPTION
    WHEN e_obj_not_exists THEN
      NULL;
  END;  
  BEGIN
    EXECUTE IMMEDIATE 'DROP TYPE XXAS_COM_PER_CONTACT_TYPE FORCE';
  EXCEPTION
    WHEN e_obj_not_exists THEN
      NULL;
  END;

  BEGIN
    EXECUTE IMMEDIATE 'DROP TYPE XXAS_COM_CONTACT_VARRAY FORCE';
  EXCEPTION
    WHEN e_obj_not_exists THEN
      NULL;
  END;  
  BEGIN
    EXECUTE IMMEDIATE 'DROP TYPE XXAS_COM_CONTACT_TYPE FORCE';
  EXCEPTION
    WHEN e_obj_not_exists THEN
      NULL;
  END;
END;
/

CREATE OR REPLACE TYPE XXAS_COM_CONTACT_TYPE AS OBJECT
  (order_sequence       number
  ,contact_type_code    varchar2(30)
  ,contact_type_name    varchar2(400)
  ,icon                 varchar2(30)
  ,contact_data         varchar2(400)
  ,contact_data_notes   varchar2(400)
  ,preferred_flag       varchar2(30)
  ,preferred_notes      varchar2(400))
/

CREATE OR REPLACE TYPE XXAS_COM_CONTACT_VARRAY AS
VARRAY(100000) OF xxas_com_contact_type
/

CREATE OR REPLACE TYPE XXAS_COM_PER_CONTACT_TYPE AS OBJECT
  (person_id            number
  ,effective_date       date
  ,contact_details      xxas_com_contact_varray)
/

CREATE OR REPLACE TYPE XXAS_COM_PER_CONTACT_VARRAY AS
VARRAY(100000) OF xxas_com_per_contact_type
/

COMMIT;
EXIT;
