REM
REM $Header: emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/slm/em_slm_calendar_types.sql rbali_oneoff_updated/1 2025/03/14 06:41:13 rbali Exp $
REM
REM em_slm_calendar_types.sql
REM
REM Copyright (c) 2007, 2025, Oracle and/or its affiliates. 
REM All rights reserved.

REM BEGIN EMRU_FILE_METADATA
REM EMRU_SOURCE_FILE:emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/slm/em_slm_calendar_types.sql
REM EMRU_UNIX_DELIVERABLES:
REM emcore/source/oracle/sysman/emdrep/sql/core/11.2.0.1/slm/em_slm_calendar_types.sql

REM EMRU_FILE_POSTINSTALL:<!!! enter the view based location of the executable file. If there is NONE leave as-is !!!>
REM EMRU_GENERIC_FLAG:NONE
REM END EMRU_FILE_METADATA

REM
REM    NAME
REM      em_slm_calendar_types.sql - <one-line expansion of the name>
REM
REM    DESCRIPTION
REM      <short description of component this file declares/defines>
REM
REM    NOTES
REM      <other useful comments, qualifications, etc.>
REM
REM    MODIFIED   (MM/DD/YY)
REM    rnadidar    02/11/15 - cut over to EBR
REM    mfidanbo    04/04/07 - review comments
REM    mfidanbo    03/20/07 - add headers
REM    mfidanbo    02/23/07 - Created
REM

ALTER SESSION SET CURRENT_SCHEMA=SYSMAN_TYPES;

CREATE OR REPLACE TYPE EM_SLM_TIME_PERIOD_OBJ AS OBJECT
  (
    start_ts                 DATE,
    end_ts                   DATE,
    
    ORDER MEMBER FUNCTION COMPARE(obj EM_SLM_TIME_PERIOD_OBJ) RETURN INTEGER
  );
/

grant execute on EM_SLM_TIME_PERIOD_OBJ to sysman;

create or replace noneditionable synonym SYSMAN.EM_SLM_TIME_PERIOD_OBJ for EM_SLM_TIME_PERIOD_OBJ;


CREATE OR REPLACE TYPE BODY EM_SLM_TIME_PERIOD_OBJ AS
  ORDER MEMBER FUNCTION COMPARE(obj EM_SLM_TIME_PERIOD_OBJ) RETURN INTEGER
    IS
  BEGIN
    IF (SELF.start_ts > obj.start_ts) THEN
      RETURN 1;
    ELSIF (SELF.start_ts = obj.start_ts) THEN
      RETURN 0;
    ELSE
      RETURN -1;
    END IF;
  END COMPARE;
END;
/

grant execute on EM_SLM_TIME_PERIOD_OBJ to sysman;


CREATE OR REPLACE TYPE EM_SLM_TIME_PERIOD_OBJ_ARRAY AS VARRAY(500) OF EM_SLM_TIME_PERIOD_OBJ;
/

grant execute on EM_SLM_TIME_PERIOD_OBJ_ARRAY to sysman;

create or replace noneditionable synonym SYSMAN.EM_SLM_TIME_PERIOD_OBJ_ARRAY for EM_SLM_TIME_PERIOD_OBJ_ARRAY;


ALTER SESSION SET CURRENT_SCHEMA=SYSMAN;



