Created by Corina C Larsen, last modified by Miki Yanagi on Feb 23, 2023
This original address view is pulling the first row in the ADDRESSES table.
This table is NOT institution specific. It represents original address at time of application to any UMS institutions.
| Key | Record.Fieldname | Format | XLAT | Heading Text |
|---|---|---|---|---|
| ADDRESS1 - Address Line 1 | Char55 | Address 1 | ||
| ADDRESS2 - Address Line 2 | Char55 | Address 2 | ||
| ADDRESS3 - Address Line 3 | Char55 | Address 3 | ||
| ADDRESS4 - Address Line 4 | Char55 | Address 4 | ||
| ADDRESS_TYPE - Address Type | Char4 | Addr Type | ||
| CITIZENSHIP_STATUS - Citizenship Status | Char1 | Status | ||
| CITY - City | Char30 | City | ||
| COUNTRY - Country | Char3 | Country | ||
| COUNTY - County | Char30 | County | ||
| EMPLID - Empl ID | Char11 | ID | ||
| POSTAL - Postal Code | Char12 | Postal | ||
| STATE - State | Char6 | State | ||
| UM_COUNTRY_OTH - Country Other | Char3 | Country Oth |
SQL for PS_UM_ORIG_ADDR_VW Expand source
SELECT DISTINCT A.EMPLID,
A.ADDRESS1,
A.ADDRESS2,
A.ADDRESS3,
A.ADDRESS4,
A.CITY,
A.STATE,
B.UM_COUNTY_NAME,
A.POSTAL,
A.COUNTRY,
A.ADDRESS_TYPE,
NVL(Z.CITIZENSHIP_STATUS, ' ') AS CITIZENSHIP_STATUS,
NVL(X.COUNTRY, ' ') AS COUNTRY_OTHER
FROM SYSADM.PS_ADDRESSES A
LEFT OUTER JOIN SYSADM.PS_UM_ZIP_COUNTY B
ON (SUBSTR(A.POSTAL, 1, 5) = B.UM_ZIP_CD)
LEFT OUTER JOIN (SELECT EMPLID,
MAX(COUNTRY) AS COUNTRY,
MAX(CITIZENSHIP_STATUS) AS CITIZENSHIP_STATUS
FROM SYSADM.PS_CITIZENSHIP
WHERE (COUNTRY <> 'USA' AND CITIZENSHIP_STATUS <> '4')
GROUP BY EMPLID) X
ON (A.EMPLID = X.EMPLID)
LEFT OUTER JOIN (SELECT EMPLID, CITIZENSHIP_STATUS CITIZENSHIP_STATUS
FROM SYSADM.PS_CITIZENSHIP
WHERE COUNTRY = 'USA') Z
ON (A.EMPLID = Z.EMPLID)
WHERE A.EFFDT = (SELECT MIN(A_ED.EFFDT)
FROM SYSADM.PS_ADDRESSES A_ED
WHERE A.EMPLID = A_ED.EMPLID
AND A.ADDRESS_TYPE = A_ED.ADDRESS_TYPE
AND A_ED.EFFDT <= SYSDATE)
AND DECODE(A.ADDRESS_TYPE,
'HOME',
1,
'BILL',
2,
'MAIL',
3,
'BUSN',
4,
'CHK',
5,
'CAMP',
6,
'RESH',
7,
8) =
(SELECT MIN(DECODE(C.ADDRESS_TYPE,
'HOME',
1,
'BILL',
2,
'MAIL',
3,
'BUSN',
4,
'CHK',
5,
'CAMP',
6,
'RESH',
7,
8))
FROM SYSADM.PS_ADDRESSES C
WHERE A.EMPLID = C.EMPLID
AND C.EFFDT = (SELECT MIN(C_ED.EFFDT)
FROM SYSADM.PS_ADDRESSES C_ED
WHERE C.EMPLID = C_ED.EMPLID
AND C.ADDRESS_TYPE = C_ED.ADDRESS_TYPE
AND C_ED.EFFDT <= SYSDATE));