Rem
Rem $Header: emcore/source/oracle/sysman/emdrep/sql/core/12.1.0.4/group/group_types.sql rbali_oneoff_updated/1 2025/03/14 06:41:13 rbali Exp $
Rem
Rem group_types.sql
Rem
Rem Copyright (c) 2013, 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/12.1.0.4/group/group_types.sql
Rem EMRU_UNIX_DELIVERABLES:
Rem emcore/source/oracle/sysman/emdrep/sql/core/12.1.0.4/group/group_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      group_types.sql - SQL types related to groups for PS3
Rem
Rem    DESCRIPTION
Rem      Creation of types related to groups for PS3
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    gbafna      01/07/25 - make synonyms noneditionable
Rem    rnadidar    02/11/15 - cut over to EBR
Rem    aimamnue    09/12/13 - Bug 17533481 - Fix code to handle existence of type EM_GROUP_EVENT_ARRAY 
Rem    aimamnue    09/12/13 - Created
Rem
Rem    BEGIN SQL_FILE_METADATA 
Rem    SQL_SOURCE_FILE: emcore/source/oracle/sysman/emdrep/sql/core/12.1.0.4/group/group_types.sql 
Rem    SQL_SHIPPED_FILE: 
Rem    SQL_PHASE: 
Rem    SQL_STARTUP_MODE: NORMAL 
Rem    SQL_IGNORABLE_ERRORS: NONE 
Rem    SQL_CALLING_FILE: 
Rem    END SQL_FILE_METADATA

-- Values for event types
-- 1. 1 (Property change)   
-- 2. 2 (Dynamic group membership refresh)

-- Values for Applicable To 
-- 1. 1 (Both Admin and Dynamic Group)
-- 2. 2 (Dynamic Group)
-- 3. 3 (Admin Group)
    
-- group_id will be filled in case of 
-- dynamic group membership refresh

ALTER SESSION SET CURRENT_SCHEMA=SYSMAN_TYPES;

BEGIN
  EXECUTE IMMEDIATE 
  'CREATE OR REPLACE TYPE EM_GROUP_EVENT_OBJ AS OBJECT
  (
    event_type         NUMBER(1),

    applicable_to      NUMBER(1),
    message_id         RAW(16),
    update_sequence_no NUMBER,

    group_id           RAW(16),
    
    CONSTRUCTOR FUNCTION EM_GROUP_EVENT_OBJ(applicable_to NUMBER, sequence_no NUMBER) RETURN SELF AS RESULT,

    CONSTRUCTOR FUNCTION EM_GROUP_EVENT_OBJ(applicable_to NUMBER, event_type NUMBER, group_id RAW) RETURN SELF AS RESULT
  ) NOT FINAL' ;

EXCEPTION
WHEN OTHERS THEN
 IF SQLCODE != -02303
 THEN
   RAISE;
 END IF; 
END;
/

grant execute on EM_GROUP_EVENT_OBJ to sysman;

create or replace noneditionable synonym SYSMAN.EM_GROUP_EVENT_OBJ for EM_GROUP_EVENT_OBJ;



ALTER SESSION SET CURRENT_SCHEMA=SYSMAN;


CREATE OR REPLACE TYPE EM_GROUP_EVENT_ARRAY AS TABLE OF EM_GROUP_EVENT_OBJ;
/


