REM This file updates the Meta Data tables for 6i 4.7

DECLARE

BEGIN





-- M92.001
-- delete OSG row if it already exists
delete from RM$NLS_DATA_TYPE_VALUES
where NLS_LANGUAGE='US'
and   DID=22302
and   SEQ is null
and   DEV_VALUE='OSG'
and   NLS_VALUE = 'Server Generator';

insert into RM$NLS_DATA_TYPE_VALUES
(NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)
values  ('US', 22302, null, 'OSG', 'Server Generator');





-- M92.002
-- Maintain tables REF_VALUES and RM$DATA_TYPE_VALUES

-- In case the patch is being rerun, delete rows to be inserted to avoid ORA errors

------------------------------------------------------------------------------------------------------------------------
-- REF_DOMAIN = PLS_DATATYPE (RM$NLS_DATA_TYPE_VALUES.DID=22482)
-- Used in call adjust_datatype_sizes in package cihpgd (Program Datum, cipgd.hpb) for value_datatype
-- Used in call in_domain in package cioprogram_datum   (Program Datum, cipgd.opb) for value_datatype
-- Used in call in_domain in package ciodatastructure_item (Datastructure Item,ciitm.opb) for datatype
--
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BINARY_INTEGER' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BOOLEAN' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'onlp{1:32767}' where REF_CODE = 'CHAR' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'onlp{1:32767}' where REF_CODE = 'CHARACTER' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'DATE' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'DEC' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'DECIMAL' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = '2n p{0:}' where REF_CODE = 'DOUBLE PRECISION' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = '2n p{0:}' where REF_CODE = 'FLOAT' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'INT' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'INTEGER' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'on  p{1:32767}' where REF_CODE = 'LONG' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'on  p{1:32767}' where REF_CODE = 'LONG RAW' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'NATURAL' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'NUMBER' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'NUMERIC' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'POSITIVE' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'yn p{1:32767}' where REF_CODE = 'RAW' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = '2n p{0:}' where REF_CODE = 'REAL' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'ROWID' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'SMALLINT' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'onlp{1:32767}' where REF_CODE = 'STRING' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'ynlp{1:32767}' where REF_CODE = 'VARCHAR' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'ynlp{1:32767}' where REF_CODE = 'VARCHAR2' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BFILE' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BLOB' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'CLOB' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'MLSLABEL' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'NATURALN' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'onlp{1:16384}' where REF_CODE = 'NCHAR' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'NCLOB' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'ynlp{1:16384}' where REF_CODE = 'NVARCHAR2' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'PLS_INTEGER' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'POSITIVEN' and REF_DOMAIN = 'PLS_DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'SIGNTYPE' and REF_DOMAIN = 'PLS_DATATYPE';

-- Insert missing rows
--
delete  REF_VALUES
where   REF_DOMAIN = 'PLS_DATATYPE'
and     REF_CODE in ( 'INTERVAL DAY TO SECOND',
                      'INTERVAL YEAR TO MONTH',
                      'TIMESTAMP',
                      'TIMESTAMP WITH LOCAL TIME ZONE',
                      'TIMESTAMP WITH TIME ZONE',
                      'UROWID' );

insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
     ('INTERVAL DAY TO SECOND', 'PLS_DATATYPE','oo p{0:9}s{0:9}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
     ('INTERVAL YEAR TO MONTH', 'PLS_DATATYPE','on p{0:4}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP', 'PLS_DATATYPE','no s{0:9}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP WITH LOCAL TIME ZONE', 'PLS_DATATYPE','no s{0:9}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP WITH TIME ZONE', 'PLS_DATATYPE','no s{0:9}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('UROWID', 'PLS_DATATYPE','on p{0:}', null, null) ;

-- Missing from RM$NLS_DATA_TYPE_VALUES(22482)
-- Used to populate PL/SQL Program Data datatype drop down list.
--
delete RM$NLS_DATA_TYPE_VALUES
where  DID          = 22482
and    NLS_LANGUAGE = 'US'
and    DEV_VALUE    = 'TIMESTAMP';

insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22482, null, 'TIMESTAMP', 'TIMESTAMP') ;


------------------------------------------------------------------------------------------------------------------------


-- REF_DOMAIN = 'DATATYPE_LARGE_PLSQL' (RM$NLS_DATA_TYPE_VALUES.DID=22375)
-- According to CDAPI documentation, this should be used for PL/SQL Module Arguments
-- so set REF_MEANING to length/precision/scale
-- Used in call in_domain             in package cioplsql_module    (Plsql Module,ciplm.opb)    for return_type
-- Used in call adjust_datatype_sizes in package ciomodule_argument (Module Argument,ciarg.hpb) for datatype of PL/SQL arguments

update REF_VALUES set REF_MEANING = 'nn'  where REF_DOMAIN = 'DATATYPE_LARGE_PLSQL';
update REF_VALUES set REF_MEANING = 'nnl' where REF_CODE = 'CHAR' and REF_DOMAIN = 'DATATYPE_LARGE_PLSQL';
update REF_VALUES set REF_MEANING = 'nnl' where REF_CODE = 'CHARACTER' and REF_DOMAIN = 'DATATYPE_LARGE_PLSQL';
update REF_VALUES set REF_MEANING = 'nnl' where REF_CODE = 'NCHAR' and REF_DOMAIN = 'DATATYPE_LARGE_PLSQL';
update REF_VALUES set REF_MEANING = 'nnl' where REF_CODE = 'NVARCHAR2' and REF_DOMAIN = 'DATATYPE_LARGE_PLSQL';
update REF_VALUES set REF_MEANING = 'nnl' where REF_CODE = 'STRING' and REF_DOMAIN = 'DATATYPE_LARGE_PLSQL';
update REF_VALUES set REF_MEANING = 'nnl' where REF_CODE = 'VARCHAR' and REF_DOMAIN = 'DATATYPE_LARGE_PLSQL';
update REF_VALUES set REF_MEANING = 'nnl' where REF_CODE = 'VARCHAR2' and REF_DOMAIN = 'DATATYPE_LARGE_PLSQL';

-- missing
delete  REF_VALUES
where   REF_DOMAIN = 'DATATYPE_LARGE_PLSQL'
and     REF_CODE in ( 'INTERVAL DAY TO SECOND',
                      'INTERVAL YEAR TO MONTH',
                      'TIMESTAMP',
                      'TIMESTAMP WITH LOCAL TIME ZONE',
                      'TIMESTAMP WITH TIME ZONE',
                      'UROWID');

insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('INTERVAL DAY TO SECOND', 'DATATYPE_LARGE_PLSQL','nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('INTERVAL YEAR TO MONTH', 'DATATYPE_LARGE_PLSQL','nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP', 'DATATYPE_LARGE_PLSQL','nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP WITH LOCAL TIME ZONE', 'DATATYPE_LARGE_PLSQL','nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP WITH TIME ZONE', 'DATATYPE_LARGE_PLSQL','nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('UROWID', 'DATATYPE_LARGE_PLSQL','nn', null, null) ;

-- Missing from RM$NLS_DATA_TYPE_VALUES(22375)
-- Used to populate PL/SQL Argument and Return Type drop down lists.
--
delete  RM$NLS_DATA_TYPE_VALUES
where   RM$NLS_DATA_TYPE_VALUES.DID = 22375
and     NLS_LANGUAGE = 'US'
and     DEV_VALUE in ('INTERVAL DAY TO SECOND',
                      'INTERVAL YEAR TO MONTH',
                      'TIMESTAMP',
                      'TIMESTAMP WITH LOCAL TIME ZONE',
                      'TIMESTAMP WITH TIME ZONE',
                      'UROWID');

insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22375, null, 'INTERVAL DAY TO SECOND', 'INTERVAL DAY TO SECOND') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22375, null, 'INTERVAL YEAR TO MONTH', 'INTERVAL YEAR TO MONTH') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22375, null, 'TIMESTAMP', 'TIMESTAMP') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22375, null, 'TIMESTAMP WITH LOCAL TIME ZONE', 'TIMESTAMP WITH LOCAL TIME ZONE') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22375, null, 'TIMESTAMP WITH TIME ZONE', 'TIMESTAMP WITH TIME ZONE') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22375, null, 'UROWID', 'UROWID') ;


------------------------------------------------------------------------------------------------------------------------

-- REF_DOMAIN = DATATYPE (RM$NLS_DATA_TYPE_VALUES.DID = 22568 )
-- Used in call adjust_datatype_sizes in package cihcol (Column,cicol.hpb) for datatype
-- Used in call adjust_datatype_sizes in package cihdom (Column,cidom.hpb) for datatype
-- Used in call in_domain in package ciodomain (Domain,cidom.opb)          for datatype
-- 
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BFILE' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BLOB' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'onlp{1:2000}' where REF_CODE = 'CHAR' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'CLOB' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'DATE' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'DECIMAL' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'DOUBLE PRECISION' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'EMBED' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = '2n p{1:126}' where REF_CODE = 'FLOAT' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'on' where REF_CODE = 'GRAPHIC' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'IMAGE' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'INTEGER' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'oo p{0:9}s{0:9}' where REF_CODE = 'INTERVAL DAY TO SECOND' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'on p{0:4}' where REF_CODE = 'INTERVAL YEAR TO MONTH' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'LONG' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'LONG RAW' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'on' where REF_CODE = 'LONG VARCHAR' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'LONG VARGRAPHIC' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'MLSLABEL' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'onlp{1:2000}' where REF_CODE = 'NCHAR' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'NCLOB' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'NUMBER' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'ynlp{1:4000}' where REF_CODE = 'NVARCHAR2' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'OID' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'ynlp{1:2000}' where REF_CODE = 'RAW' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'REAL' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'REF' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'ROWID' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'SMALLINT' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'SOUND' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'TEXT' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'TIME' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP WITH LOCAL TIME ZONE' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP WITH TIME ZONE' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'on p{0:4000}' where REF_CODE = 'UROWID' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'ynlp{1:4000}' where REF_CODE = 'VARCHAR' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'ynlp{1:4000}' where REF_CODE = 'VARCHAR2' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'yn' where REF_CODE = 'VARGRAPHIC' and REF_DOMAIN = 'DATATYPE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'VIDEO' and REF_DOMAIN = 'DATATYPE';

-- a PL/SQL type only, and none of the other PL/SQL only types are included  
delete REF_VALUES
where  REF_DOMAIN = 'DATATYPE'
and    REF_CODE   = 'BINARY_INTEGER'; 


-- Insert missing
delete  REF_VALUES
where   REF_DOMAIN = 'DATATYPE'
and     REF_CODE in ( 'CHARACTER',
                      'DEC',
                      'INT',
                      'NUMERIC');

insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('CHARACTER', 'DATATYPE','onl', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('DEC', 'DATATYPE','o3 p{1:38}s{-84:127}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('INT', 'DATATYPE','nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('NUMERIC', 'DATATYPE','oo', null, null) ;


-- RM$NLS_DATA_TYPE_VALUES(22568)
-- Used to populate drop down lists for columns and collection types. Collection types
-- should use values corresponding to REF_DOMAIN=COLLECTION_SCALAR_TYPES but there is
-- currently no corresponding row in RM_DATA_TYPES 
--
delete RM$NLS_DATA_TYPE_VALUES
where  DID = 22568
and    DEV_VALUE    = 'BINARY_INTEGER'       -- a PL/SQL type only, and none of the other PL/SQL only types are included  
and    NLS_LANGUAGE = 'US';

-- Insert Missing
delete RM$NLS_DATA_TYPE_VALUES
where  DID = 22568
and    NLS_LANGUAGE = 'US'
and    DEV_VALUE in ( 'CHARACTER',
                      'DEC',
                      'INT',
                      'NUMERIC' );

insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE) values
  ('US', 22568, null, 'CHARACTER', 'CHARACTER');
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE) values
  ('US', 22568, null, 'DEC', 'DEC');
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE) values
  ('US', 22568, null, 'INT', 'INT');
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE) values
  ('US', 22568, null, 'NUMERIC', 'NUMERIC');


------------------------------------------------------------------------------------------------------------------------

-- REF_DOMAIN = DATATYPE_LARGE  (RM$NLS_DATA_TYPE_VALUES.DID=22424)
-- REF_MEANING contains REF_CODE values.
-- According to CDAPI documentation this should be Used for General Module Arguments. 
-- Where the datatype has a length, precision or scale in the DATA_TYPE domain, I am setting it here, but it
-- is never mandatory as I don't know if they should be (unlike PL/SQL where arguments never have length,
-- precision or scale). I have also included PL/SQL only data types in case GEM modules can be converted into PL/SQL.
-- Used in call adjust_datatype_sizes in package ciomodule_argument (Module Argument,ciarg.hpb) for datatype of GEM modules
-- Used in call in_domain in package ciomodule_argument (Module Argument,ciarg.opb) for datatype of GEM modules

update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BFILE' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BINARY_INTEGER' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BLOB' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'BOOLEAN' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'onlp{1:2000}' where REF_CODE = 'CHAR' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'onl' where REF_CODE = 'CHARACTER' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'CLOB' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'DATE' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'DEC' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'DECIMAL' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'DOUBLE PRECISION' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = '2n p{1:126}' where REF_CODE = 'FLOAT' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'on' where REF_CODE = 'GRAPHIC' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'IMAGE' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'INT' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'INTEGER' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'oo p{0:9}s{0:9}' where REF_CODE = 'INTERVAL DAY TO SECOND' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'on p{0:4}' where REF_CODE = 'INTERVAL YEAR TO MONTH' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'LONG' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'LONG RAW' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'LONG VARCHAR' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'on' where REF_CODE = 'LONG VARGRAPHIC' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'MLSLABEL' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'NATURAL' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'NATURALN' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'NCHAR' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'NCLOB' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'NUMBER' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'oo' where REF_CODE = 'NUMERIC' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'onlp{1:4000}' where REF_CODE = 'NVARCHAR2' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'PLS_INTEGER' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'POSITIVE' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'POSITIVEN' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'onlp{1:2000}' where REF_CODE = 'RAW' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'REAL' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'ROWID' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'SIGNTYPE' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'SMALLINT' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'SOUND' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'onlp{1:32767}' where REF_CODE = 'STRING' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'TEXT' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'TIME' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP WITH LOCAL TIME ZONE' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP WITH TIME ZONE' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'on p{0:4000}' where REF_CODE = 'UROWID' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'onlp{1:4000}' where REF_CODE = 'VARCHAR' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'onlp{1:4000}' where REF_CODE = 'VARCHAR2' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'on' where REF_CODE = 'VARGRAPHIC' and REF_DOMAIN = 'DATATYPE_LARGE';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'VIDEO' and REF_DOMAIN = 'DATATYPE_LARGE';


------------------------------------------------------------------------------------------------------------------------

-- REF_DOMAIN = 'CLUSTER_COLUMN_DATATYPE' (RM$NLS_DATA_TYPE_VALUES.DID=22396)
-- Used in call in_domain in package ciocluster_column  (Cluster Column,ciccd.opb)  for datatype

-- Delete invalid datatypes (NB. the non Oracle types are converted to LONG RAW by CASESG, and LONG RAW is invalid)
-- and values to be inserted
delete REF_VALUES
where  REF_DOMAIN = 'CLUSTER_COLUMN_DATATYPE'
and    REF_CODE in ('BFILE', 'CFILE', 'BLOB', 'CLOB', 'BINARY_INTEGER',
                    'GRAPHIC', 'IMAGE', 'LONG VARCHAR','LONG VARGRAPHIC', 'SOUND', 'TEXT', 'VARGRAPHIC', 'VIDEO',
                    'MLSLABEL', 'NCHAR', 'NVARCHAR2'  );

insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('MLSLABEL', 'CLUSTER_COLUMN_DATATYPE', 'MLSLABEL', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('NCHAR', 'CLUSTER_COLUMN_DATATYPE', 'NCHAR', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('NVARCHAR2', 'CLUSTER_COLUMN_DATATYPE', 'NVARCHAR2', null, null) ;


delete RM$NLS_DATA_TYPE_VALUES
where  DID = 22396
and    DEV_VALUE in ( 'BFILE', 'CFILE', 'BLOB', 'CLOB', 'BINARY_INTEGER',
                      'GRAPHIC', 'IMAGE', 'LONG VARCHAR','LONG VARGRAPHIC', 'SOUND', 'TEXT', 'VARGRAPHIC', 'VIDEO',
                      'MLSLABEL', 'NCHAR', 'NVARCHAR2'  );

insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22396, null, 'MLSLABEL', 'MLSLABEL') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22396, null, 'NCHAR', 'NCHAR') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22396, null, 'NVARCHAR2', 'NVARCHAR2') ;

------------------------------------------------------------------------------------------------------------------------


-- REF_DOMAIN = COLLECTION_SCALAR_DATATYPE  (RM$NLS_DATA_TYPE_VALUES.DID=????) 
-- Doesn't exist yet, but required as many of the column types in DATA_TYPE which it curently uses aren't valid
-- and the limits are different, e.g VARCHAR2(1:32767). See BUG 1461754.
-- => Use in call adjust_datatype_sizes in package cihoct (Oracle Collection Type,cioct.hpb) for scalar_datatype

-- Need corresponding RM$NLS_DATA_TYPE_VALUES definitions for collection types drop down datatype list, but
-- creating these cannot be done with simple inserts as there is no DID. Needs to be created through the
-- model generation process.

delete REF_VALUES
where  REF_DOMAIN = 'COLLECTION_SCALAR_DATATYPE';

insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('BFILE', 'COLLECTION_SCALAR_DATATYPE', 'nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('BLOB', 'COLLECTION_SCALAR_DATATYPE', 'nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('CHAR', 'COLLECTION_SCALAR_DATATYPE', 'onlp{1:32767}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('CHARACTER', 'COLLECTION_SCALAR_DATATYPE', 'onlp{1:32767}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('CLOB', 'COLLECTION_SCALAR_DATATYPE', 'nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('DATE', 'COLLECTION_SCALAR_DATATYPE', 'nn', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('DEC', 'COLLECTION_SCALAR_DATATYPE', 'o3 p{1:38}s{-84:127}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('DECIMAL', 'COLLECTION_SCALAR_DATATYPE', 'o3 p{1:38}s{-84:127}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('DOUBLE PRECISION', 'COLLECTION_SCALAR_DATATYPE', '2n p{1:126}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('FLOAT', 'COLLECTION_SCALAR_DATATYPE', '2n p{1:126}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('INT', 'COLLECTION_SCALAR_DATATYPE', 'o3 p{1:38}s{-84:127}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('INTEGER', 'COLLECTION_SCALAR_DATATYPE', 'o3 p{1:38}s{-84:127}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('INTERVAL DAY TO SECOND', 'COLLECTION_SCALAR_DATATYPE', 'oo p{0:9}s{0:9}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('INTERVAL YEAR TO MONTH', 'COLLECTION_SCALAR_DATATYPE', 'on p{0:4}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('NCHAR', 'COLLECTION_SCALAR_DATATYPE', 'onlp{1:32767}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('NUMBER', 'COLLECTION_SCALAR_DATATYPE', 'o3 p{1:38}s{-84:127}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('NUMERIC', 'COLLECTION_SCALAR_DATATYPE', 'o3 p{1:38}s{-84:127}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('NVARCHAR2', 'COLLECTION_SCALAR_DATATYPE', 'ynlp{1:32767}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('REAL', 'COLLECTION_SCALAR_DATATYPE', '2n p{1:126}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('SMALLINT', 'COLLECTION_SCALAR_DATATYPE', 'o3 p{1:38}s{-84:127}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP', 'COLLECTION_SCALAR_DATATYPE', 'no s{0:9}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP WITH LOCAL TIME ZONE', 'COLLECTION_SCALAR_DATATYPE', 'no s{0:9}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('TIMESTAMP WITH TIME ZONE', 'COLLECTION_SCALAR_DATATYPE', 'no s{0:9}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('VARCHAR', 'COLLECTION_SCALAR_DATATYPE', 'ynlp{1:32767}', null, null) ;
insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
    ('VARCHAR2', 'COLLECTION_SCALAR_DATATYPE', 'ynlp{1:32767}', null, null) ;

------------------------------------------------------------------------------------------------------------------------

-- REF_DOMAIN = 'DATAFORMAT' (RM$NLS_DATA_TYPE_VALUES.DID=22633)
-- Delete duplicate UROWID row. This domain should contain REF_MEANING = 'UROWID'
-- and REF_DOMAIN = 'DATA_FORMAT' should contain REF_MEANING = 'nn (no size)'.

delete from REF_VALUES
where REF_DOMAIN = 'DATAFORMAT'
and   REF_CODE   = 'UROWID';

insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
  ('UROWID', 'DATAFORMAT', 'UROWID', null, null) ;

-- Add missing rows from RM$NLS_DATA_TYPE_VALUES.NLS_VALUE, but not convinced we shouldn't be deleting them from
-- REF_VALUES
delete  RM$NLS_DATA_TYPE_VALUES
where   RM$NLS_DATA_TYPE_VALUES.DID = 22633
and     NLS_LANGUAGE = 'US'
and     DEV_VALUE in ('INTERVAL DAY TO SECOND',
                      'INTERVAL YEAR TO MONTH',
                      'TIMESTAMP WITH LOCAL TIME ZONE',
                      'TIMESTAMP WITH TIME ZONE',
                      'UROWID');

insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22633, null, 'INTERVAL DAY TO SECOND', 'INTERVAL DAY TO SECOND') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22633, null, 'INTERVAL YEAR TO MONTH', 'INTERVAL YEAR TO MONTH') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22633, null, 'TIMESTAMP WITH LOCAL TIME ZONE', 'TIMESTAMP WITH LOCAL TIME ZONE') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22633, null, 'TIMESTAMP WITH TIME ZONE', 'TIMESTAMP WITH TIME ZONE') ;
insert into RM$NLS_DATA_TYPE_VALUES (NLS_LANGUAGE, RM$NLS_DATA_TYPE_VALUES.DID, SEQ, DEV_VALUE, NLS_VALUE)
  values  ('US', 22633, null, 'UROWID', 'UROWID') ;


------------------------------------------------------------------------------------------------------------------------

-- REF_DOMAIN = 'DATA_FORMAT' (RM$NLS_DATA_TYPE_VALUES.DID=22458)
-- Used in call to adjust_datatype_sizes in package cihatt (ciatt.hpb)
-- Used in call to adjust_datatype_sizes in package cihdit (cidit.hpb)
-- Used in call to adjust_datatype_sizes in package cihdom (cidom.hpb)

update REF_VALUES set REF_MEANING = 'onlp{1:2000}' where REF_CODE = 'CHAR' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'DATE' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'IMAGE' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = '1n' where REF_CODE = 'INTEGER' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'oo p{0:9}s{0:9}' where REF_CODE = 'INTERVAL DAY TO SECOND' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'on p{0:4}' where REF_CODE = 'INTERVAL YEAR TO MONTH' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'yy' where REF_CODE = 'MONEY' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'o3 p{1:38}s{-84:127}' where REF_CODE = 'NUMBER' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'PHOTOGRAPH' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'SOUND' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'TEXT' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'TIME' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP WITH LOCAL TIME ZONE' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'no s{0:9}' where REF_CODE = 'TIMESTAMP WITH TIME ZONE' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'on p{0:4000}' where REF_CODE = 'UROWID' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'onlp{1:4000}' where REF_CODE = 'VARCHAR2' and REF_DOMAIN = 'DATA_FORMAT';
update REF_VALUES set REF_MEANING = 'nn' where REF_CODE = 'VIDEO' and REF_DOMAIN = 'DATA_FORMAT';


-- Add missing UROWID

delete REF_VALUES             
where  REF_DOMAIN = 'DATA_FORMAT'
and    REF_CODE   = 'UROWID';

insert into REF_VALUES (REF_CODE, REF_DOMAIN, REF_MEANING, REF_PARENT_CODE, REF_SYSTEM_USE) values
  ('UROWID', 'DATA_FORMAT', 'on p{1:4000}', 'UROWID', null) ;


-- RM$NLS_DATA_TYPE_VALUES(22458) has no rows





-- M92.003
execute immediate 'alter table cdi_dflt_user_pref_usages modify ( dup_type varchar2(30) )';

-- B1642706 : Added for Drop Column

DELETE FROM cdi_pref_domains WHERE pd_domain in ('DROP_SAC');
DELETE FROM cdi_valid_prefs  WHERE vp_domain in ('DROP_SAC');
DELETE FROM cdi_dflt_user_pref_usages WHERE p_sname='OSG' AND dup_sname='DRPSAC';

INSERT INTO cdi_pref_domains
        (PD_DOMAIN,        PD_DESC)
VALUES  ('DROP_SAC',      'Drop Sac');

INSERT INTO cdi_valid_prefs
        (VP_DOMAIN,        VP_VALUE,   VP_MEANING,                                 VP_ABBREVIATION,  NLS_LANG)
VALUES  ('DROP_SAC',       'ALWAYS',  'Always drop Sacs',                          'ALWAYS',         'US');

INSERT INTO cdi_valid_prefs
        (VP_DOMAIN,        VP_VALUE,   VP_MEANING,                                 VP_ABBREVIATION,  NLS_LANG)
VALUES  ('DROP_SAC',       'ASK',      'Ask which Sacs are to be dropped',         'ASK',           'US');

INSERT INTO cdi_valid_prefs
        (VP_DOMAIN,        VP_VALUE,   VP_MEANING,                                 VP_ABBREVIATION,  NLS_LANG)
VALUES  ('DROP_SAC',       'NEVER',    'Never drop Sacs',                          'NEVER',          'US');
        
INSERT INTO cdi_dflt_user_pref_usages
        (P_SNAME,       P_CGVERSION,    PF_SEQ,         DUP_SNAME,      VALUE,          DUP_INTERNAL,   DUP_TYPE,
        DESCRIPTION_MSGID,MANDATORY,    CHR_DOMAIN,     CHR_MAXLEN,     NUM_HIVAL,      NUM_LOVAL,      NLS_LANG,
        DESCRIPTION)
VALUES ('OSG',         '2.0',          1,              'DRPSAC',       'ASK',           'N', 'Generate - Tables',
        25015,         'Y',            'DROP_SAC',     '30',           '',              '',             'US',
        'Drop Column, Constraint and Index action');

UPDATE cdi_dflt_user_pref_usages SET dup_type = 'Generate - General'
WHERE  p_sname = 'OSG' and dup_type = 'Generation - General';

UPDATE cdi_dflt_user_pref_usages SET dup_type = 'Generate - TAPI'
WHERE  p_sname = 'OSG' and dup_type = 'Generation - TAPI';

UPDATE cdi_dflt_user_pref_usages SET dup_type = 'Generate - Views'
WHERE  p_sname = 'OSG' and dup_type = 'Generation - View';

UPDATE cdi_dflt_user_pref_usages SET dup_type = 'Capture - Views'
WHERE  p_sname = 'OSG' and dup_type = 'Views';

UPDATE cdi_dflt_user_pref_usages SET dup_type = 'Capture - Tables'
WHERE  p_sname = 'OSG' and dup_type = 'Tables';

UPDATE cdi_dflt_user_pref_usages SET dup_type = 'Capture - PL/SQL Definitions'
WHERE  p_sname = 'OSG' and dup_type = 'PL/SQL Definitions';

UPDATE cdi_dflt_user_pref_usages SET dup_type = 'Capture - Oracle Object Types'
WHERE  p_sname = 'OSG' and dup_type = 'Oracle Object Types';

UPDATE cdi_dflt_user_pref_usages SET dup_type = 'Capture - Materialized Views'
WHERE  p_sname = 'OSG' and dup_type = 'Materialized Views';





-- M92.004
delete from cdi_dflt_user_pref_usages
where P_SNAME = 'CGSF'
and P_CGVERSION = '5.0'
and PF_SEQ = 1
and DUP_SNAME = 'GLNCON';


delete from cdi_pref_domains
where PD_DOMAIN = 'GLNCON_OPTIONS';


delete from cdi_valid_prefs
where VP_DOMAIN  = 'GLNCON_OPTIONS';


insert into cdi_dflt_user_pref_usages
(P_SNAME
,P_CGVERSION
,PF_SEQ
,DUP_SNAME
,DESCRIPTION
,VALUE
,DUP_INTERNAL
,DUP_TYPE
,DESCRIPTION_MSGID
,MANDATORY
,CHR_DOMAIN
,CHR_MAXLEN
,NUM_HIVAL
,NUM_LOVAL
,DOM
,TAB
,CON
,COL
,MOD
,DTU
,CONU
,IGRP
,DCU
,ACI
,SUB
,LOV
,NLS_LANG)
values
(
'CGSF', -- P_SNAME
'5.0', -- P_CGVERSION
1, -- PF_SEQ
'GLNCON', -- DUP_SNAME
'Global Variable Naming convention', -- DESCRIPTION
'TABLE NAME', -- VALUE
'N', -- DUP_INTERNAL
'GENERATE OPTIONS', -- DUP_TYPE
16034, -- DESCRIPTION_MSGID
'Y', -- MANDATORY
'GLNCON_OPTIONS', -- CHR_DOMAIN
NULL,  -- CHR_MAXLEN
NULL,  -- NUM_HIVAL
NULL,  -- NUM_LOVAL
'N', -- DOM
'N', -- TAB
'N', -- CON
'N', -- COL
'Y', -- MOD
'N', -- DTU
'N', -- CONU
'N', -- IGRP
'N', -- DCU
'N', -- ACI
'N', -- SUB
'N', -- LOV
'US'); -- NLS_LANG



insert into cdi_pref_domains 
values 
('GLNCON_OPTIONS' ,'Global Naming Convention to be Followed' );
 
 
insert into cdi_valid_prefs 
values 
('GLNCON_OPTIONS' ,'TABLE NAME' ,'Use Table Name' ,'' ,'US' ); 
 

insert into cdi_valid_prefs 
values 
('GLNCON_OPTIONS' ,'TABLE ALIAS' ,'Use Table Alias' ,'' ,'US' ); 
 

insert into cdi_valid_prefs 
values 
('GLNCON_OPTIONS' ,'NAME IN DATABASE' ,'Use Name In Database' ,'' ,'US' ) ;





-- M92.007
-- Delete missing 8i SYSTEM_PRIVILEGES so we can insert them (in case patch run more than once)
--
delete REF_VALUES
where  REF_DOMAIN = 'SYSTEM_PRIVILEGES'
and    REF_MEANING in ( 'ALTER ANY OPERATOR' );

-- Insert missing 8i SYSTEM_PRIVILEGES 
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('ALTR_ANY_OP', 'SYSTEM_PRIVILEGES', 'ALTER ANY OPERATOR');


-- Delete new 9i SYSTEM_PRIVILEGES so we can insert them (in case patch run more than once)
--
delete REF_VALUES
where REF_DOMAIN = 'SYSTEM_PRIVILEGES'
and REF_MEANING in (
'ADMINISTER SECURITY',
'ALTER ANY EVALUATION CONTEXT',
'ALTER ANY RULE',
'ALTER ANY RULE SET',
'ALTER ANY SECURITY PROFILE',
'CREATE ANY EVALUATION CONTEXT',
'CREATE ANY RULE',
'CREATE ANY RULE SET',
'CREATE ANY SECURITY PROFILE',
'CREATE EVALUATION CONTEXT',
'CREATE RULE',
'CREATE RULE SET',
'CREATE SECURITY PROFILE',
'DEBUG ANY PROCEDURE',
'DEBUG CONNECT ANY',
'DEBUG CONNECT SESSION',
'DEBUG CONNECT USER',
'DROP ANY EVALUATION CONTEXT',
'DROP ANY RULE',
'DROP ANY RULE SET',
'DROP ANY SECURITY PROFILE',
'EXECUTE ANY EVALUATION CONTEXT',
'EXECUTE ANY RULE',
'EXECUTE ANY RULE SET',
'EXEMPT ACCESS POLICY',
'FLASHBACK ANY TABLE',
'GRANT ANY OBJECT PRIVILEGE',
'ON COMMIT REFRESH',
'RESUMABLE',
'SELECT ANY DICTIONARY',
'UNDER ANY TABLE',
'UNDER ANY TYPE',
'UNDER ANY VIEW' );


-- Insert new 9i SYSTEM_PRIVILEGES
--
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('ADM_SEC', 'SYSTEM_PRIVILEGES', 'ADMINISTER SECURITY');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('ALT_ANY_EVAL_CTX', 'SYSTEM_PRIVILEGES', 'ALTER ANY EVALUATION CONTEXT');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('ALT_ANY_RULE', 'SYSTEM_PRIVILEGES', 'ALTER ANY RULE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('ALT_ANY_RULE_SET', 'SYSTEM_PRIVILEGES', 'ALTER ANY RULE SET');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('ALT_ANY_SEC_PRFL', 'SYSTEM_PRIVILEGES', 'ALTER ANY SECURITY PROFILE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CRT_ANY_EVAL_CTX', 'SYSTEM_PRIVILEGES', 'CREATE ANY EVALUATION CONTEXT');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CRT_ANY_RULE', 'SYSTEM_PRIVILEGES', 'CREATE ANY RULE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CRT_ANY_RULE_SET', 'SYSTEM_PRIVILEGES', 'CREATE ANY RULE SET');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CRT_ANY_SEC_PRFL', 'SYSTEM_PRIVILEGES', 'CREATE ANY SECURITY PROFILE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CRT_EVAL_CTX', 'SYSTEM_PRIVILEGES', 'CREATE EVALUATION CONTEXT');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CRT_RULE', 'SYSTEM_PRIVILEGES', 'CREATE RULE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CRT_RULE_SET', 'SYSTEM_PRIVILEGES', 'CREATE RULE SET');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CRT_SEC_PRFL', 'SYSTEM_PRIVILEGES', 'CREATE SECURITY PROFILE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('DBG_ANY_PRC', 'SYSTEM_PRIVILEGES', 'DEBUG ANY PROCEDURE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('DBG_CNCT_ANY', 'SYSTEM_PRIVILEGES', 'DEBUG CONNECT ANY');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('DBG_CNCT_SESS', 'SYSTEM_PRIVILEGES', 'DEBUG CONNECT SESSION');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('DBG_CNCT_USR', 'SYSTEM_PRIVILEGES', 'DEBUG CONNECT USER');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('DRP_ANY_EVAL_CTX', 'SYSTEM_PRIVILEGES', 'DROP ANY EVALUATION CONTEXT');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('DRP_ANY_RULE', 'SYSTEM_PRIVILEGES', 'DROP ANY RULE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('DRP_ANY_RULE_SET', 'SYSTEM_PRIVILEGES', 'DROP ANY RULE SET');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('DRP_ANY_SEC_PRFL', 'SYSTEM_PRIVILEGES', 'DROP ANY SECURITY PROFILE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('EXC_ANY_EVAL_CTX', 'SYSTEM_PRIVILEGES', 'EXECUTE ANY EVALUATION CONTEXT');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('EXC_ANY_RULE', 'SYSTEM_PRIVILEGES', 'EXECUTE ANY RULE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('EXC_ANY_RULE_SET', 'SYSTEM_PRIVILEGES', 'EXECUTE ANY RULE SET');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('EXMPT_ACC_PLCY', 'SYSTEM_PRIVILEGES', 'EXEMPT ACCESS POLICY');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('FLSHBCK_ANY_TBL', 'SYSTEM_PRIVILEGES', 'FLASHBACK ANY TABLE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('GRT_ANY_OBJ_PRV', 'SYSTEM_PRIVILEGES', 'GRANT ANY OBJECT PRIVILEGE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('ON_COMMIT_RFRSH', 'SYSTEM_PRIVILEGES', 'ON COMMIT REFRESH');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('RESUMABLE', 'SYSTEM_PRIVILEGES', 'RESUMABLE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('SEL_ANY_DICT', 'SYSTEM_PRIVILEGES', 'SELECT ANY DICTIONARY');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('UNDR_ANY_TBL', 'SYSTEM_PRIVILEGES', 'UNDER ANY TABLE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('UNDR_ANY_TYP', 'SYSTEM_PRIVILEGES', 'UNDER ANY TYPE');
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('UNDR_ANY_VW', 'SYSTEM_PRIVILEGES', 'UNDER ANY VIEW');



-- Delete missing 8i DID=22489 so we can insert them (in case patch run more than once)
--
delete rm$nls_data_type_values
where DID = 22489
and NLS_VALUE in ( 'ALTER ANY OPERATOR' );

-- Insert missing 8i DID=22489 
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'ALTR_ANY_OP', 'ALTER ANY OPERATOR');


-- Delete new 9i DID=22489 so we can insert them (in case patch run more than once)
--
delete rm$nls_data_type_values
where DID = 22489
and NLS_VALUE in (
'ADMINISTER SECURITY',
'ALTER ANY EVALUATION CONTEXT',
'ALTER ANY RULE',
'ALTER ANY RULE SET',
'ALTER ANY SECURITY PROFILE',
'CREATE ANY EVALUATION CONTEXT',
'CREATE ANY RULE',
'CREATE ANY RULE SET',
'CREATE ANY SECURITY PROFILE',
'CREATE EVALUATION CONTEXT',
'CREATE RULE',
'CREATE RULE SET',
'CREATE SECURITY PROFILE',
'DEBUG ANY PROCEDURE',
'DEBUG CONNECT ANY',
'DEBUG CONNECT SESSION',
'DEBUG CONNECT USER',
'DROP ANY EVALUATION CONTEXT',
'DROP ANY RULE',
'DROP ANY RULE SET',
'DROP ANY SECURITY PROFILE',
'EXECUTE ANY EVALUATION CONTEXT',
'EXECUTE ANY RULE',
'EXECUTE ANY RULE SET',
'EXEMPT ACCESS POLICY',
'FLASHBACK ANY TABLE',
'GRANT ANY OBJECT PRIVILEGE',
'ON COMMIT REFRESH',
'RESUMABLE',
'SELECT ANY DICTIONARY',
'UNDER ANY TABLE',
'UNDER ANY TYPE',
'UNDER ANY VIEW' );


-- Insert new 9i DID=22489
--
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'ADM_SEC', 'ADMINISTER SECURITY');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'ALT_ANY_EVAL_CTX', 'ALTER ANY EVALUATION CONTEXT');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'ALT_ANY_RULE', 'ALTER ANY RULE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'ALT_ANY_RULE_SET', 'ALTER ANY RULE SET');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'ALT_ANY_SEC_PRFL', 'ALTER ANY SECURITY PROFILE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'CRT_ANY_EVAL_CTX', 'CREATE ANY EVALUATION CONTEXT');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'CRT_ANY_RULE', 'CREATE ANY RULE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'CRT_ANY_RULE_SET', 'CREATE ANY RULE SET');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'CRT_ANY_SEC_PRFL', 'CREATE ANY SECURITY PROFILE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'CRT_EVAL_CTX', 'CREATE EVALUATION CONTEXT');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'CRT_RULE', 'CREATE RULE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'CRT_RULE_SET', 'CREATE RULE SET');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'CRT_SEC_PRFL', 'CREATE SECURITY PROFILE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'DBG_ANY_PRC', 'DEBUG ANY PROCEDURE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'DBG_CNCT_ANY', 'DEBUG CONNECT ANY');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'DBG_CNCT_SESS', 'DEBUG CONNECT SESSION');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'DBG_CNCT_USR', 'DEBUG CONNECT USER');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'DRP_ANY_EVAL_CTX', 'DROP ANY EVALUATION CONTEXT');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'DRP_ANY_RULE', 'DROP ANY RULE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'DRP_ANY_RULE_SET', 'DROP ANY RULE SET');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'DRP_ANY_SEC_PRFL', 'DROP ANY SECURITY PROFILE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'EXC_ANY_EVAL_CTX', 'EXECUTE ANY EVALUATION CONTEXT');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'EXC_ANY_RULE', 'EXECUTE ANY RULE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'EXC_ANY_RULE_SET', 'EXECUTE ANY RULE SET');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'EXMPT_ACC_PLCY', 'EXEMPT ACCESS POLICY');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'FLSHBCK_ANY_TBL', 'FLASHBACK ANY TABLE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'GRT_ANY_OBJ_PRV', 'GRANT ANY OBJECT PRIVILEGE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'ON_COMMIT_RFRSH', 'ON COMMIT REFRESH');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'RESUMABLE', 'RESUMABLE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'SEL_ANY_DICT', 'SELECT ANY DICTIONARY');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'UNDR_ANY_TBL', 'UNDER ANY TABLE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'UNDR_ANY_TYP', 'UNDER ANY TYPE');
insert into rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid , 'US', 22489, null,'UNDR_ANY_VW', 'UNDER ANY VIEW');


-- Set rm$nls_data_type_values.SEQ for DID=22489 to be in NLS_VALUE alphabetic order
declare
 s number := 10;
begin
  for  C in (select nls_value from rm$nls_data_type_values where did=22489 order by nls_value )
  loop
	update rm$nls_data_type_values rm set rm.seq = s where did=22489 and rm.nls_value = C.nls_value;
	s := s + 10;
  end loop;
end;





-- M92.008
-- Delete any existing refrences to CONCEAL DATA from table ref_values.
delete 
  from ref_values 
 where ref_domain = 'UBI_DISPLAY_TYPE'
   and ref_code = 'CONCEAL DATA';

delete 
  from ref_values 
 where ref_domain = 'UBI_DISPLAY_TYPE_OF'
   and ref_code = 'CONCEAL DATA';

delete 
  from ref_values 
 where ref_domain = 'UBI_DISPLAY_TYPE_WEB'
   and ref_code = 'CONCEAL DATA';

-- Insert data for new display type 'Concealed data' in table ref_values.
insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CONCEAL DATA', 'UBI_DISPLAY_TYPE', 'Concealed data');

insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CONCEAL DATA', 'UBI_DISPLAY_TYPE_OF', 'Concealed data');

insert into ref_values (REF_CODE, REF_DOMAIN, REF_MEANING)values
('CONCEAL DATA', 'UBI_DISPLAY_TYPE_WEB', 'Concealed data');

-- Delete any existing refrences to CONCEAL DATA from table rm$nls_data_type_values.
delete 
  from rm$nls_data_type_values
 where did = '22393'
   and dev_value = 'CONCEAL DATA';

delete 
  from rm$nls_data_type_values
 where did = '22558'
   and dev_value = 'CONCEAL DATA';

delete 
  from rm$nls_data_type_values
 where did = '22732'
   and dev_value = 'CONCEAL DATA';

delete 
  from rm$nls_data_type_values
 where did = '22733'
   and dev_value = 'CONCEAL DATA';

delete 
  from rm$nls_data_type_values
 where did = '22390'
   and dev_value = 'CONCEAL DATA';

delete 
  from rm$nls_data_type_values
 where did = '22736'
   and dev_value = 'CONCEAL DATA';

-- Insert data for new display type 'Concealed data' in i$rm$nls_data_type_values.
insert into i$rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid(), 'US', 22393, 43, 'CONCEAL DATA', 'Concealed data');

insert into i$rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid(), 'US', 22558, 43, 'CONCEAL DATA', 'Concealed data');

insert into i$rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid(), 'US', 22732, 45, 'CONCEAL DATA', 'Concealed data');

insert into i$rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid(), 'US', 22733, 46, 'CONCEAL DATA', 'Concealed data');

insert into i$rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid(), 'US', 22390, 47, 'CONCEAL DATA', 'Concealed data');

insert into i$rm$nls_data_type_values (irid,  NLS_LANGUAGE, DID, SEQ, DEV_VALUE, NLS_VALUE)values
(jr_util.get_new_irid(), 'US', 22736, 48, 'CONCEAL DATA', 'Concealed data');

-- This is the fix for bug #2853512
update ck_language_properties set PROPERTY_VALUE = 'UBI_DISPLAY_TYPE_WEB' where
property_number = 35 and language = 'Web';

update ck_language_properties set PROPERTY_VALUE = 'UBI_DISPLAY_TYPE_VB' where
property_number = 35 and language = 'VB';





-- M92.010
-- B2861346 : Modified preference descriptions.

DELETE FROM cdi_valid_prefs  WHERE vp_domain in ('DROP_SAC');

INSERT INTO cdi_valid_prefs
        (VP_DOMAIN,        VP_VALUE,   VP_MEANING,                                 VP_ABBREVIATION,  NLS_LANG)
VALUES  ('DROP_SAC',       'ALWAYS',  'Always drop Objects',                          'ALWAYS',         'US');

INSERT INTO cdi_valid_prefs
        (VP_DOMAIN,        VP_VALUE,   VP_MEANING,                                 VP_ABBREVIATION,  NLS_LANG)
VALUES  ('DROP_SAC',       'ASK',      'Ask which Objects are to be dropped',         'ASK',           'US');

INSERT INTO cdi_valid_prefs
        (VP_DOMAIN,        VP_VALUE,   VP_MEANING,                                 VP_ABBREVIATION,  NLS_LANG)
VALUES  ('DROP_SAC',       'NEVER',    'Never drop Objects',                          'NEVER',          'US');
        





  -- Register 4_7 Upgrade in the RM$PATCHES RM$PATCHES table
  rmpatch.install('CI04012.4_7_UPGRADE');

  rmpatch.installed_ok;



  commit;



EXCEPTION

  WHEN OTHERS THEN
    dbms_output.put_line('* Exception Raised  ');
    dbms_output.put_line('...ERROR: '||substrb(sqlerrm,1,240));
    rollback work;
    RAISE;

END;
/
