REM                                                                                                 
REM   ----------------------------------------                                                      
REM   Creating view CI_ROOT_CONTAINER_ELEMENTS                                                      
REM   ----------------------------------------                                                      
REM                                                                                                 
CREATE OR REPLACE VIEW CI_ROOT_CONTAINER_ELEMENTS                                                   
(     APPLICATION_TYPE                                                                              
,     AUTHOR                                                                                        
,     AUTHORITY                                                                                     
,     CHANGED_BY                                                                                    
,     CLASSIFIER_REFERENCE                                                                          
,     CODING_STANDARD_REFERENCE                                                                     
,     "CONSTRAINTS"                                                                                  
,     CONTAINER_SUBTYPE                                                                             
,     CREATED_BY                                                                                    
,     DATAWAREHOUSE_FLAG                                                                            
,     DATE_CHANGED                                                                                  
,     DATE_CREATED                                                                                  
,     DEVELOPMENT_LEVEL                                                                             
,     DISPLAY_TITLE                                                                                 
,     EJB_TARGET_FLAG                                                                               
,     ELEMENT_TYPE_NAME                                                                             
,     EXTERNAL_FLAG                                                                                 
,     GENERATE_CLASSES_FLAG                                                                         
,     GENERATE_IDL_FLAG                                                                             
,     GENERATE_METADATA_FLAG                                                                        
,     ICON_FILE_REFERENCE                                                                           
,     ID                                                                                            
,     IMPLEMENTATION_TARGET                                                                         
,     INSTANTIABLE_FLAG                                                                             
,     IRID                                                                                          
,     IVID                                                                                          
,     LANGUAGE_REFERENCE                                                                            
,     METADATA_CLASS_NAME                                                                           
,     NAME                                                                                          
,     NUMBER_OF_TIMES_MODIFIED                                                                      
,     O8I_TARGET_FLAG                                                                               
,     OS_TIMESTAMP                                                                                  
,     OWNING_USER                                                                                   
,     PRIORITIES                                                                                    
,     REMARK                                                                                        
,     ROOT_FLAG                                                                                     
,     SYSTEM_ELEMENT_FLAG                                                                           
,     TRANSFORMER_STANDARD_REFERENCE                                                                
,     TYPE                                                                                          
,     TYPES                                                                                         
,     USER_DEFINED_PROPERTY_0                                                                       
,     USER_DEFINED_PROPERTY_1                                                                       
,     USER_DEFINED_PROPERTY_10                                                                      
,     USER_DEFINED_PROPERTY_11                                                                      
,     USER_DEFINED_PROPERTY_12                                                                      
,     USER_DEFINED_PROPERTY_13                                                                      
,     USER_DEFINED_PROPERTY_14                                                                      
,     USER_DEFINED_PROPERTY_15                                                                      
,     USER_DEFINED_PROPERTY_16                                                                      
,     USER_DEFINED_PROPERTY_17                                                                      
,     USER_DEFINED_PROPERTY_18                                                                      
,     USER_DEFINED_PROPERTY_19                                                                      
,     USER_DEFINED_PROPERTY_2                                                                       
,     USER_DEFINED_PROPERTY_3                                                                       
,     USER_DEFINED_PROPERTY_4                                                                       
,     USER_DEFINED_PROPERTY_5                                                                       
,     USER_DEFINED_PROPERTY_6                                                                       
,     USER_DEFINED_PROPERTY_7                                                                       
,     USER_DEFINED_PROPERTY_8                                                                       
,     USER_DEFINED_PROPERTY_9                                                                       
,     VISIBROKER_TARGET_FLAG                                                                        
) AS                                                                                                
SELECT THE_TAB.APPLICATION_TYPE                                                                     
,      THE_TAB.AUTHOR                                                                               
,      THE_TAB.AUTHORITY                                                                            
,      THE_TAB.CHANGED_BY                                                                           
,      THE_TAB.CLASSIFIER_REF                                                                       
,      THE_TAB.CODING_STANDARD_REF                                                                  
,      THE_TAB.CONSTRAINTS                                                                          
,      THE_TAB.CONTAINER_SUBTYPE                                                                    
,      THE_TAB.CREATED_BY                                                                           
,      THE_TAB.DATAWAREHOUSE_FLAG                                                                   
,      THE_TAB.DATE_CHANGED                                                                         
,      THE_TAB.DATE_CREATED                                                                         
,      THE_TAB.DEVELOPMENT_LEVEL                                                                    
,      THE_TAB.DISPLAY_TITLE                                                                        
,      THE_TAB.EJB_TARGET_FLAG                                                                      
,      THE_TAB.ELEMENT_TYPE_NAME                                                                    
,      THE_TAB.EXTERNAL_FLAG                                                                        
,      THE_TAB.GENERATE_CLASSES_FLAG                                                                
,      THE_TAB.GENERATE_IDL_FLAG                                                                    
,      THE_TAB.GENERATE_METADATA_FLAG                                                               
,      THE_TAB.ICON_FILE_REF                                                                        
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IMPLEMENTATION_TARGET                                                                
,      THE_TAB.INSTANTIABLE_FLAG                                                                    
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IVID                                                                                 
,      THE_TAB.LANGUAGE_REF                                                                         
,      THE_TAB.METADATA_CLASS_NAME                                                                  
,      THE_TAB.NAME                                                                                 
,      THE_TAB.NOTM                                                                                 
,      THE_TAB.O8I_TARGET_FLAG                                                                      
,      THE_TAB.OS_TIMESTAMP                                                                         
,      THE_TAB.OWNING_USER                                                                          
,      THE_TAB.PRIORITIES                                                                           
,      THE_TAB.REMARK                                                                               
,      THE_TAB.ROOT_FLAG                                                                            
,      THE_TAB.SYSTEM_ELEMENT_FLAG                                                                  
,      THE_TAB.TRANSFORMER_STANDARD_REF                                                             
,      THE_TAB.TYPE                                                                                 
,      THE_TAB.TYPES                                                                                
,      THE_TAB.USRX0                                                                                
,      THE_TAB.USRX1                                                                                
,      THE_TAB.USRX10                                                                               
,      THE_TAB.USRX11                                                                               
,      THE_TAB.USRX12                                                                               
,      THE_TAB.USRX13                                                                               
,      THE_TAB.USRX14                                                                               
,      THE_TAB.USRX15                                                                               
,      THE_TAB.USRX16                                                                               
,      THE_TAB.USRX17                                                                               
,      THE_TAB.USRX18                                                                               
,      THE_TAB.USRX19                                                                               
,      THE_TAB.USRX2                                                                                
,      THE_TAB.USRX3                                                                                
,      THE_TAB.USRX4                                                                                
,      THE_TAB.USRX5                                                                                
,      THE_TAB.USRX6                                                                                
,      THE_TAB.USRX7                                                                                
,      THE_TAB.USRX8                                                                                
,      THE_TAB.USRX9                                                                                
,      THE_TAB.VISIBROKER_TARGET_FLAG                                                               
FROM   I$SDD_FOLDERS the_tab                                                                        
WHERE ( (     JR_CONTEXT.WORKAREA IS NULL                                                           
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_OBJECT_VERSIONS  OV                                             
                       WHERE  OV.IVID          = THE_TAB.IVID                                       
                       AND    OV.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                             
                     )                                                                              
        ) OR                                                                                        
        (     JR_CONTEXT.WORKAREA IS NOT NULL                                                       
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_WA_CONTEXT CTXT                                                 
                       WHERE  CTXT.OBJECT_IVID   = THE_TAB.IVID                                     
                       AND    CTXT.WORKAREA_IRID = JR_CONTEXT.WORKAREA                              
                       AND    CTXT.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                           
                     )                                                                              
      ) )                                                                                           
AND   ( EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = USER                                                
               ) OR                                                                                 
        EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = 'PUBLIC'                                            
               )                                                                                    
      )                                                                                             
AND   ROOT_FLAG = 'Y'                                                                               
WITH READ ONLY;                                                                                     
REM                                                                                                 
REM   ------------------------------                                                                
REM   Creating view CI_ROOT_PACKAGES                                                                
REM   ------------------------------                                                                
REM                                                                                                 
CREATE OR REPLACE VIEW CI_ROOT_PACKAGES                                                             
(     AUTHOR                                                                                        
,     CHANGED_BY                                                                                    
,     CLASSIFIER_REFERENCE                                                                          
,     CONTAINER_SUBTYPE                                                                             
,     CREATED_BY                                                                                    
,     DATE_CHANGED                                                                                  
,     DATE_CREATED                                                                                  
,     EJB_TARGET_FLAG                                                                               
,     ELEMENT_TYPE_NAME                                                                             
,     EXTERNAL_FLAG                                                                                 
,     GENERATE_METADATA_FLAG                                                                        
,     ICON_FILE_REFERENCE                                                                           
,     ID                                                                                            
,     IMPLEMENTATION_TARGET                                                                         
,     INSTANTIABLE_FLAG                                                                             
,     IRID                                                                                          
,     IVID                                                                                          
,     LANGUAGE_REFERENCE                                                                            
,     METADATA_CLASS_NAME                                                                           
,     NAME                                                                                          
,     NUMBER_OF_TIMES_MODIFIED                                                                      
,     O8I_TARGET_FLAG                                                                               
,     OS_TIMESTAMP                                                                                  
,     OWNING_USER                                                                                   
,     ROOT_FLAG                                                                                     
,     SYSTEM_ELEMENT_FLAG                                                                           
,     TYPE                                                                                          
,     TYPES                                                                                         
,     VISIBROKER_TARGET_FLAG                                                                        
) AS                                                                                                
SELECT THE_TAB.AUTHOR                                                                               
,      THE_TAB.CHANGED_BY                                                                           
,      THE_TAB.CLASSIFIER_REF                                                                       
,      THE_TAB.CONTAINER_SUBTYPE                                                                    
,      THE_TAB.CREATED_BY                                                                           
,      THE_TAB.DATE_CHANGED                                                                         
,      THE_TAB.DATE_CREATED                                                                         
,      THE_TAB.EJB_TARGET_FLAG                                                                      
,      THE_TAB.ELEMENT_TYPE_NAME                                                                    
,      THE_TAB.EXTERNAL_FLAG                                                                        
,      THE_TAB.GENERATE_METADATA_FLAG                                                               
,      THE_TAB.ICON_FILE_REF                                                                        
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IMPLEMENTATION_TARGET                                                                
,      THE_TAB.INSTANTIABLE_FLAG                                                                    
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IVID                                                                                 
,      THE_TAB.LANGUAGE_REF                                                                         
,      THE_TAB.METADATA_CLASS_NAME                                                                  
,      THE_TAB.NAME                                                                                 
,      THE_TAB.NOTM                                                                                 
,      THE_TAB.O8I_TARGET_FLAG                                                                      
,      THE_TAB.OS_TIMESTAMP                                                                         
,      THE_TAB.OWNING_USER                                                                          
,      THE_TAB.ROOT_FLAG                                                                            
,      THE_TAB.SYSTEM_ELEMENT_FLAG                                                                  
,      THE_TAB.TYPE                                                                                 
,      THE_TAB.TYPES                                                                                
,      THE_TAB.VISIBROKER_TARGET_FLAG                                                               
FROM   I$SDD_FOLDERS the_tab                                                                        
WHERE ( (     JR_CONTEXT.WORKAREA IS NULL                                                           
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_OBJECT_VERSIONS  OV                                             
                       WHERE  OV.IVID          = THE_TAB.IVID                                       
                       AND    OV.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                             
                     )                                                                              
        ) OR                                                                                        
        (     JR_CONTEXT.WORKAREA IS NOT NULL                                                       
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_WA_CONTEXT CTXT                                                 
                       WHERE  CTXT.OBJECT_IVID   = THE_TAB.IVID                                     
                       AND    CTXT.WORKAREA_IRID = JR_CONTEXT.WORKAREA                              
                       AND    CTXT.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                           
                     )                                                                              
      ) )                                                                                           
AND   ( EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = USER                                                
               ) OR                                                                                 
        EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = 'PUBLIC'                                            
               )                                                                                    
      )                                                                                             
AND   ROOT_FLAG = 'Y'                                                                               
AND   THE_TAB.TYPES = 4842                                                                          
WITH READ ONLY;                                                                                     
REM                                                                                                 
REM   -----------------------------                                                                 
REM   Creating view CI_ROOT_FOLDERS                                                                 
REM   -----------------------------                                                                 
REM                                                                                                 
CREATE OR REPLACE VIEW CI_ROOT_FOLDERS                                                              
(     CHANGED_BY                                                                                    
,     CONTAINER_SUBTYPE                                                                             
,     CREATED_BY                                                                                    
,     DATE_CHANGED                                                                                  
,     DATE_CREATED                                                                                  
,     ELEMENT_TYPE_NAME                                                                             
,     ID                                                                                            
,     IRID                                                                                          
,     IVID                                                                                          
,     NAME                                                                                          
,     NUMBER_OF_TIMES_MODIFIED                                                                      
,     OS_TIMESTAMP                                                                                  
,     OWNING_USER                                                                                   
,     ROOT_FLAG                                                                                     
,     SYSTEM_ELEMENT_FLAG                                                                           
,     TYPES                                                                                         
) AS                                                                                                
SELECT THE_TAB.CHANGED_BY                                                                           
,      THE_TAB.CONTAINER_SUBTYPE                                                                    
,      THE_TAB.CREATED_BY                                                                           
,      THE_TAB.DATE_CHANGED                                                                         
,      THE_TAB.DATE_CREATED                                                                         
,      THE_TAB.ELEMENT_TYPE_NAME                                                                    
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IVID                                                                                 
,      THE_TAB.NAME                                                                                 
,      THE_TAB.NOTM                                                                                 
,      THE_TAB.OS_TIMESTAMP                                                                         
,      THE_TAB.OWNING_USER                                                                          
,      THE_TAB.ROOT_FLAG                                                                            
,      THE_TAB.SYSTEM_ELEMENT_FLAG                                                                  
,      THE_TAB.TYPES                                                                                
FROM   I$SDD_FOLDERS the_tab                                                                        
WHERE ( (     JR_CONTEXT.WORKAREA IS NULL                                                           
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_OBJECT_VERSIONS  OV                                             
                       WHERE  OV.IVID          = THE_TAB.IVID                                       
                       AND    OV.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                             
                     )                                                                              
        ) OR                                                                                        
        (     JR_CONTEXT.WORKAREA IS NOT NULL                                                       
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_WA_CONTEXT CTXT                                                 
                       WHERE  CTXT.OBJECT_IVID   = THE_TAB.IVID                                     
                       AND    CTXT.WORKAREA_IRID = JR_CONTEXT.WORKAREA                              
                       AND    CTXT.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                           
                     )                                                                              
      ) )                                                                                           
AND   ( EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = USER                                                
               ) OR                                                                                 
        EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = 'PUBLIC'                                            
               )                                                                                    
      )                                                                                             
AND   ROOT_FLAG = 'Y'                                                                               
AND   THE_TAB.TYPES = 4844                                                                          
WITH READ ONLY;                                                                                     
REM                                                                                                 
REM   -----------------------------------------                                                     
REM   Creating view CI_ROOT_APPLICATION_SYSTEMS                                                     
REM   -----------------------------------------                                                     
REM                                                                                                 
CREATE OR REPLACE VIEW CI_ROOT_APPLICATION_SYSTEMS                                                  
(     APPLICATION_TYPE                                                                              
,     AUTHORITY                                                                                     
,     CHANGED_BY                                                                                    
,     "CONSTRAINTS"                                                                                  
,     CONTAINER_SUBTYPE                                                                             
,     CREATED_BY                                                                                    
,     DATAWAREHOUSE_FLAG                                                                            
,     DATE_CHANGED                                                                                  
,     DATE_CREATED                                                                                  
,     DISPLAY_TITLE                                                                                 
,     ELEMENT_TYPE_NAME                                                                             
,     ID                                                                                            
,     IRID                                                                                          
,     IVID                                                                                          
,     NAME                                                                                          
,     NUMBER_OF_TIMES_MODIFIED                                                                      
,     OS_TIMESTAMP                                                                                  
,     OWNING_USER                                                                                   
,     PRIORITIES                                                                                    
,     REMARK                                                                                        
,     ROOT_FLAG                                                                                     
,     SYSTEM_ELEMENT_FLAG                                                                           
,     TYPES                                                                                         
,     USER_DEFINED_PROPERTY_0                                                                       
,     USER_DEFINED_PROPERTY_1                                                                       
,     USER_DEFINED_PROPERTY_10                                                                      
,     USER_DEFINED_PROPERTY_11                                                                      
,     USER_DEFINED_PROPERTY_12                                                                      
,     USER_DEFINED_PROPERTY_13                                                                      
,     USER_DEFINED_PROPERTY_14                                                                      
,     USER_DEFINED_PROPERTY_15                                                                      
,     USER_DEFINED_PROPERTY_16                                                                      
,     USER_DEFINED_PROPERTY_17                                                                      
,     USER_DEFINED_PROPERTY_18                                                                      
,     USER_DEFINED_PROPERTY_19                                                                      
,     USER_DEFINED_PROPERTY_2                                                                       
,     USER_DEFINED_PROPERTY_3                                                                       
,     USER_DEFINED_PROPERTY_4                                                                       
,     USER_DEFINED_PROPERTY_5                                                                       
,     USER_DEFINED_PROPERTY_6                                                                       
,     USER_DEFINED_PROPERTY_7                                                                       
,     USER_DEFINED_PROPERTY_8                                                                       
,     USER_DEFINED_PROPERTY_9                                                                       
) AS                                                                                                
SELECT THE_TAB.APPLICATION_TYPE                                                                     
,      THE_TAB.AUTHORITY                                                                            
,      THE_TAB.CHANGED_BY                                                                           
,      THE_TAB.CONSTRAINTS                                                                          
,      THE_TAB.CONTAINER_SUBTYPE                                                                    
,      THE_TAB.CREATED_BY                                                                           
,      THE_TAB.DATAWAREHOUSE_FLAG                                                                   
,      THE_TAB.DATE_CHANGED                                                                         
,      THE_TAB.DATE_CREATED                                                                         
,      THE_TAB.DISPLAY_TITLE                                                                        
,      THE_TAB.ELEMENT_TYPE_NAME                                                                    
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IVID                                                                                 
,      THE_TAB.NAME                                                                                 
,      THE_TAB.NOTM                                                                                 
,      THE_TAB.OS_TIMESTAMP                                                                         
,      THE_TAB.OWNING_USER                                                                          
,      THE_TAB.PRIORITIES                                                                           
,      THE_TAB.REMARK                                                                               
,      THE_TAB.ROOT_FLAG                                                                            
,      THE_TAB.SYSTEM_ELEMENT_FLAG                                                                  
,      THE_TAB.TYPES                                                                                
,      THE_TAB.USRX0                                                                                
,      THE_TAB.USRX1                                                                                
,      THE_TAB.USRX10                                                                               
,      THE_TAB.USRX11                                                                               
,      THE_TAB.USRX12                                                                               
,      THE_TAB.USRX13                                                                               
,      THE_TAB.USRX14                                                                               
,      THE_TAB.USRX15                                                                               
,      THE_TAB.USRX16                                                                               
,      THE_TAB.USRX17                                                                               
,      THE_TAB.USRX18                                                                               
,      THE_TAB.USRX19                                                                               
,      THE_TAB.USRX2                                                                                
,      THE_TAB.USRX3                                                                                
,      THE_TAB.USRX4                                                                                
,      THE_TAB.USRX5                                                                                
,      THE_TAB.USRX6                                                                                
,      THE_TAB.USRX7                                                                                
,      THE_TAB.USRX8                                                                                
,      THE_TAB.USRX9                                                                                
FROM   I$SDD_FOLDERS the_tab                                                                        
WHERE ( (     JR_CONTEXT.WORKAREA IS NULL                                                           
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_OBJECT_VERSIONS  OV                                             
                       WHERE  OV.IVID          = THE_TAB.IVID                                       
                       AND    OV.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                             
                     )                                                                              
        ) OR                                                                                        
        (     JR_CONTEXT.WORKAREA IS NOT NULL                                                       
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_WA_CONTEXT CTXT                                                 
                       WHERE  CTXT.OBJECT_IVID   = THE_TAB.IVID                                     
                       AND    CTXT.WORKAREA_IRID = JR_CONTEXT.WORKAREA                              
                       AND    CTXT.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                           
                     )                                                                              
      ) )                                                                                           
AND   ( EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = USER                                                
               ) OR                                                                                 
        EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = 'PUBLIC'                                            
               )                                                                                    
      )                                                                                             
AND   ROOT_FLAG = 'Y'                                                                               
AND   THE_TAB.TYPES = 5009                                                                          
WITH READ ONLY;                                                                                     
REM                                                                                                 
REM   ------------------------------                                                                
REM   Creating view CI_ROOT_PROJECTS                                                                
REM   ------------------------------                                                                
REM                                                                                                 
CREATE OR REPLACE VIEW CI_ROOT_PROJECTS                                                             
(     CHANGED_BY                                                                                    
,     CODING_STANDARD_REFERENCE                                                                     
,     CONTAINER_SUBTYPE                                                                             
,     CREATED_BY                                                                                    
,     DATE_CHANGED                                                                                  
,     DATE_CREATED                                                                                  
,     DEVELOPMENT_LEVEL                                                                             
,     EJB_TARGET_FLAG                                                                               
,     ELEMENT_TYPE_NAME                                                                             
,     GENERATE_CLASSES_FLAG                                                                         
,     GENERATE_IDL_FLAG                                                                             
,     ID                                                                                            
,     IMPLEMENTATION_TARGET                                                                         
,     IRID                                                                                          
,     IVID                                                                                          
,     LANGUAGE_REFERENCE                                                                            
,     NAME                                                                                          
,     NUMBER_OF_TIMES_MODIFIED                                                                      
,     O8I_TARGET_FLAG                                                                               
,     OS_TIMESTAMP                                                                                  
,     OWNING_USER                                                                                   
,     ROOT_FLAG                                                                                     
,     SYSTEM_ELEMENT_FLAG                                                                           
,     TRANSFORMER_STANDARD_REFERENCE                                                                
,     TYPES                                                                                         
,     VISIBROKER_TARGET_FLAG                                                                        
) AS                                                                                                
SELECT THE_TAB.CHANGED_BY                                                                           
,      THE_TAB.CODING_STANDARD_REF                                                                  
,      THE_TAB.CONTAINER_SUBTYPE                                                                    
,      THE_TAB.CREATED_BY                                                                           
,      THE_TAB.DATE_CHANGED                                                                         
,      THE_TAB.DATE_CREATED                                                                         
,      THE_TAB.DEVELOPMENT_LEVEL                                                                    
,      THE_TAB.EJB_TARGET_FLAG                                                                      
,      THE_TAB.ELEMENT_TYPE_NAME                                                                    
,      THE_TAB.GENERATE_CLASSES_FLAG                                                                
,      THE_TAB.GENERATE_IDL_FLAG                                                                    
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IMPLEMENTATION_TARGET                                                                
,      THE_TAB.IRID                                                                                 
,      THE_TAB.IVID                                                                                 
,      THE_TAB.LANGUAGE_REF                                                                         
,      THE_TAB.NAME                                                                                 
,      THE_TAB.NOTM                                                                                 
,      THE_TAB.O8I_TARGET_FLAG                                                                      
,      THE_TAB.OS_TIMESTAMP                                                                         
,      THE_TAB.OWNING_USER                                                                          
,      THE_TAB.ROOT_FLAG                                                                            
,      THE_TAB.SYSTEM_ELEMENT_FLAG                                                                  
,      THE_TAB.TRANSFORMER_STANDARD_REF                                                             
,      THE_TAB.TYPES                                                                                
,      THE_TAB.VISIBROKER_TARGET_FLAG                                                               
FROM   I$SDD_FOLDERS the_tab                                                                        
WHERE ( (     JR_CONTEXT.WORKAREA IS NULL                                                           
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_OBJECT_VERSIONS  OV                                             
                       WHERE  OV.IVID          = THE_TAB.IVID                                       
                       AND    OV.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                             
                     )                                                                              
        ) OR                                                                                        
        (     JR_CONTEXT.WORKAREA IS NOT NULL                                                       
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_WA_CONTEXT CTXT                                                 
                       WHERE  CTXT.OBJECT_IVID   = THE_TAB.IVID                                     
                       AND    CTXT.WORKAREA_IRID = JR_CONTEXT.WORKAREA                              
                       AND    CTXT.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                           
                     )                                                                              
      ) )                                                                                           
AND   ( EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = USER                                                
               ) OR                                                                                 
        EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = 'PUBLIC'                                            
               )                                                                                    
      )                                                                                             
AND   ROOT_FLAG = 'Y'                                                                               
AND   THE_TAB.TYPES = 5127                                                                          
WITH READ ONLY;                                                                                     
                                                                                                    
REM                                                                                                 
REM   -----------------------------------------                                                     
REM   Creating view SDD_ROOT_CONTAINER_ELEMENTS                                                     
REM   -----------------------------------------                                                     
REM                                                                                                 
CREATE OR REPLACE VIEW SDD_ROOT_CONTAINER_ELEMENTS AS                                               
SELECT THE_TAB.IRID                                                                                 
,      THE_TAB.TYPES                                                                                
,      THE_TAB.ELEMENT_TYPE_NAME                                                                    
,      THE_TAB.DATE_CREATED                                                                         
,      THE_TAB.CREATED_BY                                                                           
,      THE_TAB.DATE_CHANGED                                                                         
,      THE_TAB.CHANGED_BY                                                                           
,      THE_TAB.NOTM                                                                                 
,      THE_TAB.OWNING_USER                                                                          
,      THE_TAB.CONTAINER_SUBTYPE                                                                    
,      THE_TAB.AUTHORITY                                                                            
,      THE_TAB.CONSTRAINTS                                                                          
,      THE_TAB.DATAWAREHOUSE_FLAG                                                                   
,      THE_TAB.PRIORITIES                                                                           
,      THE_TAB.REMARK                                                                               
,      THE_TAB.GENERATE_CLASSES_FLAG                                                                
,      THE_TAB.USRX0                                                                                
,      THE_TAB.USRX1                                                                                
,      THE_TAB.USRX10                                                                               
,      THE_TAB.USRX11                                                                               
,      THE_TAB.USRX12                                                                               
,      THE_TAB.USRX13                                                                               
,      THE_TAB.USRX14                                                                               
,      THE_TAB.USRX15                                                                               
,      THE_TAB.USRX16                                                                               
,      THE_TAB.USRX17                                                                               
,      THE_TAB.USRX18                                                                               
,      THE_TAB.USRX19                                                                               
,      THE_TAB.USRX2                                                                                
,      THE_TAB.USRX3                                                                                
,      THE_TAB.USRX4                                                                                
,      THE_TAB.USRX5                                                                                
,      THE_TAB.USRX6                                                                                
,      THE_TAB.USRX7                                                                                
,      THE_TAB.USRX8                                                                                
,      THE_TAB.USRX9                                                                                
,      THE_TAB.NAME                                                                                 
,      THE_TAB.APPLICATION_TYPE                                                                     
,      THE_TAB.IVID                                                                                 
,      THE_TAB.TYPE                                                                                 
,      THE_TAB.CLASSIFIER_REF                                                                       
,      THE_TAB.EXTERNAL_FLAG                                                                        
,      THE_TAB.INSTANTIABLE_FLAG                                                                    
,      THE_TAB.LANGUAGE_REF                                                                         
,      THE_TAB.AUTHOR                                                                               
,      THE_TAB.CODING_STANDARD_REF                                                                  
,      THE_TAB.IMPLEMENTATION_TARGET                                                                
,      THE_TAB.DISPLAY_TITLE                                                                        
,      THE_TAB.TRANSFORMER_STANDARD_REF                                                             
,      THE_TAB.ICON_FILE_REF                                                                        
,      THE_TAB.DEVELOPMENT_LEVEL                                                                    
,      THE_TAB.OS_TIMESTAMP                                                                         
,      THE_TAB.ROOT_FLAG                                                                            
,      THE_TAB.O8I_TARGET_FLAG                                                                      
,      THE_TAB.VISIBROKER_TARGET_FLAG                                                               
,      THE_TAB.EJB_TARGET_FLAG                                                                      
,      THE_TAB.GENERATE_IDL_FLAG                                                                    
,      THE_TAB.GENERATE_METADATA_FLAG                                                               
,      THE_TAB.METADATA_CLASS_NAME                                                                  
,      THE_TAB.SYSTEM_ELEMENT_FLAG                                                                  
FROM   I$SDD_FOLDERS the_tab                                                                        
WHERE ( (     JR_CONTEXT.WORKAREA IS NULL                                                           
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_OBJECT_VERSIONS  OV                                             
                       WHERE  OV.IVID          = THE_TAB.IVID                                       
                       AND    OV.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                             
                     )                                                                              
        ) OR                                                                                        
        (     JR_CONTEXT.WORKAREA IS NOT NULL                                                       
          AND EXISTS ( SELECT 1                                                                     
                       FROM   I$SDD_WA_CONTEXT CTXT                                                 
                       WHERE  CTXT.OBJECT_IVID   = THE_TAB.IVID                                     
                       AND    CTXT.WORKAREA_IRID = JR_CONTEXT.WORKAREA                              
                       AND    CTXT.WASTEBASKET   = JR_CONTEXT.WASTEBASKET                           
                     )                                                                              
      ) )                                                                                           
AND   ( EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = USER                                                
               ) OR                                                                                 
        EXISTS ( SELECT 1                                                                           
                 FROM   SDW_ACCESS_RIGHTS ACC                                                       
                 WHERE  ACC.OBJECT_REFERENCE = THE_TAB.IRID                                         
                   AND  ACC.GRANTEE_REFERENCE = 'PUBLIC'                                            
               )                                                                                    
      )                                                                                             
AND   ROOT_FLAG = 'Y'                                                                               
WITH READ ONLY;                                                                                     
