/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2015 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_SEARCH_TBL';
  EXCEPTION
    WHEN e_obj_not_exists THEN
      NULL;
  END;
  BEGIN
    EXECUTE IMMEDIATE 'DROP TYPE XXAS_SEARCH';
  EXCEPTION
    WHEN e_obj_not_exists THEN
      NULL;
  END;
  BEGIN
    EXECUTE IMMEDIATE 'DROP TYPE XXAS_SEARCH_FACETS_TBL';
  EXCEPTION
    WHEN e_obj_not_exists THEN
      NULL;
  END;
  BEGIN
    EXECUTE IMMEDIATE 'DROP TYPE XXAS_SEARCH_FACETS';
  EXCEPTION
    WHEN e_obj_not_exists THEN
      NULL;
  END;  
END;
/

CREATE OR REPLACE TYPE XXAS_SEARCH_FACETS AS OBJECT
  (facet                          VARCHAR2(400)
  ,facet_values                   xxas_com_varchar2_table);
/
  
CREATE TYPE XXAS_SEARCH_FACETS_TBL AS TABLE OF XXAS_SEARCH_FACETS;
/

CREATE OR REPLACE TYPE XXAS_SEARCH AS OBJECT
  (search_text                    VARCHAR2(4000)
  ,facets                         xxas_search_facets_tbl);
/

CREATE TYPE XXAS_SEARCH_TBL AS TABLE OF XXAS_SEARCH;
/

COMMIT;
EXIT;
