SCC_PERSMK_VW

(SQL View)
Index Back

Person Smoker View

Person Smoker View used by personal data view SCC_PERDATA_VW.

SELECT P.EMPLID ,M.SMOKER_DT ,M.SMOKER FROM PS_PERSON P , PS_PERS_SMOKER M ,PS_PERSON_DT_SETUP S WHERE M.EMPLID = P.EMPLID AND S.SMOKER_FLG = 'Y' AND M.SMOKER_DT = ( SELECT MAX(MT.SMOKER_DT) FROM PS_PERS_SMOKER MT WHERE MT.EMPLID = M.EMPLID AND MT.SMOKER_DT <= %CurrentDateIn) UNION SELECT PX.EMPLID ,%DateNull ,' ' FROM PS_PERSON PX WHERE NOT EXISTS ( SELECT 'X' FROM PS_PERS_SMOKER MX ,PS_PERSON_DT_SETUP SX WHERE MX.EMPLID = PX.EMPLID AND SX.SMOKER_FLG = 'Y' AND MX.SMOKER_DT = ( SELECT MAX(MXT.SMOKER_DT) FROM PS_PERS_SMOKER MXT WHERE MXT.EMPLID = MX.EMPLID AND MXT.SMOKER_DT <= %CurrentDateIn) )

# PeopleSoft Field Name PeopleSoft Field Type Database Column Type Description
1 EMPLID Character(11) VARCHAR2(11) NOT NULL Employee ID

Default Value: PERSON.EMPLID

Prompt Table: PERSON

2 SMOKER_DT Date(10) DATE NOT NULL Smoker Date
3 SMOKER Character(1) VARCHAR2(1) NOT NULL A flag that indicates whether or not (Y or N) an employee or dependent is a smoker.
N=Non Smoker
Y=Smoker