/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2013 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
  EXECUTE IMMEDIATE 'DROP TYPE xxas_attachment_table force';
  EXECUTE IMMEDIATE 'DROP TYPE xxas_attachment_type force';
EXCEPTION
  WHEN e_obj_not_exists THEN
    NULL;
END;
/

CREATE TYPE xxas_attachment_type AS OBJECT
  (attached_document_id number
  ,sequence_number      number
  ,entity_name          varchar2(40)
  ,pk1_value            varchar2(100)
  ,pk2_value            varchar2(100)
  ,pk3_value            varchar2(100)
  ,pk4_value            varchar2(100)
  ,pk5_value            varchar2(100)
  ,category_code        varchar2(400)
  ,category_name        varchar2(400)
  ,document_id          number
  ,file_name            varchar2(4000)
  ,title                varchar2(4000)
  ,description          varchar2(4000)
  ,file_id              number
  ,mime_type            varchar2(400)
  ,lob_format           varchar2(400)
  ,file_url             varchar2(4000)
  ,wp_link              varchar2(1000)
  ,creation_date        date
  ,created_by           varchar2(400)
  ,last_update_date     date
  ,last_updated_by      varchar2(400))
/

CREATE OR REPLACE TYPE xxas_attachment_table IS
TABLE OF xxas_attachment_type
/

COMMIT;
EXIT;
