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

DECLARE

BEGIN





-- M93.001
-- Add CKUEELD to User Extensions group
delete CK_REPORT_GROUP_USAGES
where  RGU_RPT_ID = 25
and    RGU_RPG_ID = 16;

insert into CK_REPORT_GROUP_USAGES
( RGU_RPT_ID, RGU_RPG_ID, RGU_SEQUENCE, CK_USER_DEFINED, CK_USER )
values ( 25, 16, 3, 'N', 'SYS' );

-- Add CKUEELD to Element group
delete CK_REPORT_GROUP_USAGES
where  RGU_RPT_ID = 25
and    RGU_RPG_ID = 45;

insert into CK_REPORT_GROUP_USAGES
( RGU_RPT_ID, RGU_RPG_ID, RGU_SEQUENCE, CK_USER_DEFINED, CK_USER )
values( 25, 45, 1, 'N', 'SYS' );

-- Add CDELTXT to Element group
delete CK_REPORT_GROUP_USAGES
where  RGU_RPT_ID = 119
and    RGU_RPG_ID = 45;

insert into CK_REPORT_GROUP_USAGES
( RGU_RPT_ID, RGU_RPG_ID, RGU_SEQUENCE, CK_USER_DEFINED, CK_USER )
values( 119, 45, 8, 'N', 'SYS' );





-- M93.005 - instance data but checked with Ash whether it is okay to include it here
-- Turn off access rights checking ...
jr_context.disable(jr_context.NO_CHECKIN_UPDATE);
jr_context.disable(jr_context.ACCESS_RIGHTS);

update I$SDD_SPV
set    GRANT_OPTION_TO = 'DBU'
where  DATABASE_USER_REF IS NOT NULL
and    ROLE_REF IS NULL
and    GRANT_OPTION_TO = 'GRP';

-- Restore access rights checking ...
jr_context.enable(jr_context.NO_CHECKIN_UPDATE);
jr_context.enable(jr_context.ACCESS_RIGHTS);





-- M93.007
delete from cdi_dflt_user_pref_usages
where P_SNAME = 'CGSF'
and P_CGVERSION = '5.0'
and PF_SEQ = 1
and DUP_SNAME = 'DMLRET';


delete from cdi_pref_domains
where PD_DOMAIN = 'DMLRET_VALS';


delete from cdi_valid_prefs
where VP_DOMAIN  = 'DMLRET_VALS';


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
'DMLRET', -- DUP_SNAME
'Set DML Returning Value', -- DESCRIPTION
'DEFAULT', -- VALUE
'N', -- DUP_INTERNAL
'GENERATE OPTIONS', -- DUP_TYPE
16037, -- DESCRIPTION_MSGID
'Y', -- MANDATORY
'DMLRET_VALS', -- CHR_DOMAIN
NULL,  -- CHR_MAXLEN
NULL,  -- NUM_HIVAL
NULL,  -- NUM_LOVAL
'N', -- DOM
'N', -- TAB
'Y', -- CON
'N', -- COL
'Y', -- MOD
'Y', -- DTU
'N', -- CONU
'N', -- IGRP
'N', -- DCU
'N', -- ACI
'N', -- SUB
'N', -- LOV
'US'); -- NLS_LANG


insert into cdi_pref_domains 
values 
('DMLRET_VALS' ,'DML Returning Value' );

 
insert into cdi_valid_prefs 
values 
('DMLRET_VALS' ,'DEFAULT' ,'Let Generator Decide' ,'' ,'US' );


insert into cdi_valid_prefs 
values 
('DMLRET_VALS' ,'NO' ,'No' ,'' ,'US' );





-- M93.008
-- B2938697 : 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 secondary elements',                          'ALWAYS',         'US');

INSERT INTO cdi_valid_prefs
        (VP_DOMAIN,        VP_VALUE,   VP_MEANING,                                 VP_ABBREVIATION,  NLS_LANG)
VALUES  ('DROP_SAC',       'ASK',      'Ask which secondary elements 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 secondary elements',                          'NEVER',          'US');





  -- Register 4_8 Upgrade in the RM$PATCHES RM$PATCHES table
  rmpatch.install('CI04012.4_8_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;
/
