SPOOL create_cnppv_v.lst

CREATE OR REPLACE VIEW cont_net_point_param_vals_v AS
SELECT cnppv_id
     , value
     , conp_id
     , copa_id
FROM   cont_net_point_param_vals
WHERE  conp_id IN
      ( SELECT conp_id
        FROM   cont_network_points
        WHERE  cont_id IN
              ( SELECT cont_id
                FROM   contracts
                WHERE  cust_id IN
                      ( SELECT cust_id
                        FROM   customers
                        WHERE  cuty_id IN
                              ( SELECT cuty_id
                                FROM   customer_types
                                WHERE  code IN
                                      ( SELECT SUBSTR(granted_role,5,3)
                                        FROM   user_role_privs
                                        WHERE  granted_role IN ('EFT_OMT_RO','EFT_PUW_RO')
                                      )
                              )
                      )
              )
      )
AND    copa_id IN
      ( SELECT copa_id
        FROM   contract_parameters
        WHERE  cont_id IN
              ( SELECT cont_id
                FROM   contracts
                WHERE  cust_id IN
                      ( SELECT cust_id
                        FROM   customers
                        WHERE  cuty_id IN
                              ( SELECT cuty_id
                                FROM   customer_types
                                WHERE  code IN
                                      ( SELECT SUBSTR(granted_role,5,3)
                                        FROM   user_role_privs
                                        WHERE  granted_role IN ('EFT_OMT_RO','EFT_PUW_RO')
                                      )
                              )
                      )
              )
      )
/

SPOOL OFF
