Rem    NAME 
Rem      ckpriovw.sql
Rem    DESCRIPTION
Rem      creates Package Resolved view on CK_INSTALLED_OBJECTS
REm    RETURNS
Rem 	 None
Rem    NOTES
Rem      Please not that if you try to run this script via SQL*Plus 
Rem      You will get errors because at RUNtime the RAU seds the appropriate package context
Rem    CREATED
Rem	  07/12/99

create or replace view ck_installed_objects_resolved 
as 
select CI_STAGE 
,      CI_TYPE 
,      CI_NAME 
,      CI_CREATED 
,      CI_NO_OF_ROWS 
,      CI_DIR 
,      CI_FILENAME 
,      CI_COMMENT 
,      CI_PIN_FLAG 
,      CI_OWNER 
,      CI_INITIAL 
,      CI_NEXT 
,      CI_PCTINCREASE 
,      CI_TABLESPACE 
,      CI_TABLE_IRID 
from ck_installed_objects 
where ci_stage in ( 'JRTYPE'  ,'CKTABS'   ,'JRTAB'    ,'CKROBTAB' ,'JRVIEW'
                  , 'JRLOB'   ,'JRLOBIDX' ,'CKINDX'   ,'CKVIEW'   ,'CKPRIOVW'
                  , 'CKCONST' ,'CKSEQ'    ,'JRSYN'    ,'CKPACCOM' ,'JRPACK'
                  , 'CKCOMVW' ,'JRCON'    ,'CKROBCON' ,'CKROBSEQ' ,'CKROBPAC'
                  , 'CKROBFUN') 
union 
select CI_STAGE 
,      CI_TYPE 
,      CI_NAME 
,      CI_CREATED 
,      CI_NO_OF_ROWS 
,      CI_DIR 
,      CI_FILENAME 
,      CI_COMMENT 
,      CI_PIN_FLAG 
,      CI_OWNER 
,      CI_INITIAL 
,      CI_NEXT 
,      CI_PCTINCREASE 
,      CI_TABLESPACE 
,      CI_TABLE_IRID 
from ck_installed_objects 
where ci_stage in ( 'CKTYPE',   'JRIND', 'JROPACK', 'JRSEQ', 'CKPACK'
                  , 'JRFUN', 'CKTRIG', 'JRTRIG', 'JRPOLICY') 
and   (    nvl(ci_owner,'X') = 'CORE'
        or ci_table_irid in ( select distinct table_irid 
                              from  ck_product_elements 
                              where product_code in (%s) 
                            )
      )
/
