SELECT c.constraint_id,
e.entity_display_name entity,
c.column_display_name attribute,
l1.meaning opeartion,
l2.meaning user_action,
l4.meaning seeded,
cc.group_number,
l3.meaning scope,
cc.validation_entity_display_name val_entity,
cc.record_set_display_name record_set,
decode(cc.modifier_flag,'Y',Null,' ') modifier,
cc.validation_tmplt_display_name val_template,
l5.meaning seeded_flag,
ONT_OEXOEPCL_XMLP_PKG.c_appl_toformula(:C_count_resp, c.constraint_id) C_APPL_TO
from oe_pc_constraints_v c,
oe_pc_entities_v e,
oe_pc_constraint_cnds_v cc,
oe_lookups l1,
oe_lookups l2,
oe_lookups l3,
oe_lookups l4,
oe_lookups l5
where c.entity_id = e.entity_id(+)
and l1.lookup_code(+) = c.constrained_operation
and l1.lookup_type(+) = 'PC_OPERATION'
and l2.lookup_code(+) = c.on_operation_action
and l2.lookup_type(+) = 'PC_ON_OPERATION_ACTION'
and l4.lookup_code(+) = c.system_flag
and l4.lookup_type(+) = 'YES_NO'
and c.constraint_id = cc.constraint_id(+)
and l3.lookup_code(+) = cc.scope_op
and l3.lookup_type(+) = 'PC_SCOPE_OP'
and l5.lookup_code(+) = cc.system_flag
and l5.lookup_type(+) = 'YES_NO'
&lp_entity
&lp_attribute
&lp_operation
&lp_val_entity
&lp_record_set
&lp_val_template
&lp_seeded
ORDER BY 1 ASC,2 ASC,3 ASC,4 ASC,5 ASC,6 ASC , e.entity_display_name , nvl ( l1.meaning , 'A' ) , nvl ( c.column_display_name , 'A' ) , cc.group_number |