MSC_AP_ORG_LOC_ASSOCIATIONS_V

Details

  • Schema: FUSION

  • Object owner: MSC

  • Object type: VIEW

Columns

Name

LOCATION_CODE

ORGANIZATION_CODE

ORGANIZATION_ID

LOCATION_ID

DEFAULT_FLAG

Query

SQL_Statement

SELECT TO_CHAR(locv.location_id) location_code ,

org.organization_code ,

hl.organization_id organization_id,

hl.location_id location_id,

1 DEFAULT_FLAG

FROM HR_ALL_ORGANIZATION_UNITS_VL hl,

INV_ORG_PARAMETERS org ,

HR_LOCATIONS_ALL_F_VL locv

WHERE hl.organization_id = org.organization_id

AND locv.location_id = hl.location_id

AND locv.active_status ='A'

AND TRUNC(SYSDATE) BETWEEN locv.effective_start_date AND locv.effective_end_date

UNION ALL

SELECT TO_CHAR(locv.location_id) location_code ,

org.organization_code ,

locv.inventory_organization_id organization_id,

locv.location_id location_id,

2 default_flag

FROM HR_LOCATIONS_ALL_F_VL locv,

INV_ORG_PARAMETERS org

WHERE locv.inventory_organization_id = org.organization_id

AND locv.active_status ='A'

AND TRUNC(SYSDATE) BETWEEN locv.effective_start_date AND locv.effective_end_date

AND NOT EXISTS

(SELECT 1

FROM HR_ALL_ORGANIZATION_UNITS_VL hl

WHERE hl.location_id =locv.location_id

AND hl.organization_id=org.organization_id

)