-- cookie cutter SELECT code

--**Use this information and these scripts at your own risk. As a condition of using these scripts and information from this site, you agree to hold harmless both the University of Arkansas Cooperative Extension Service and Bruce Knox for any problems that they may cause or other situations that may arise from their use, and that neither the Extension Service nor I will be held liable for those consequences. The scripts and information are provided "as is" without warranty, implied or otherwise. Limitation of liability will be the amount paid to the University of Arkansas specifically for this information. (It was free:) 

SELECT
FTVORGN_FMGR_CODE_PIDM||PEVEMPL_ORGN_CODE_HOME||PEVEMPL_FULL_NAME   Sort_Order,
PEVEMPL_ORGN_CODE_HOME|| ' '||PEVEMPL_FULL_NAME                     Detail_String,
FTVORGN_FMGR_CODE_PIDM                                              Report_pidm
FROM PEVEMPL,
(
SELECT
  FTVORGN_ORGN_CODE FTVORGN_ORGN_CODE,
  FTVORGN_FMGR_CODE_PIDM FTVORGN_FMGR_CODE_PIDM
  FROM FTVORGN
 WHERE
 TRUNC(FTVORGN_EFF_DATE) <= SYSDATE
   AND  (FTVORGN_NCHG_DATE  > TRUNC(SYSDATE) OR FTVORGN_NCHG_DATE IS NULL)
   AND  (FTVORGN_TERM_DATE  > TRUNC(SYSDATE) OR FTVORGN_TERM_DATE IS NULL)
   AND   FTVORGN_STATUS_IND = 'A'
)
WHERE (PEVEMPL_ORGN_CODE_HOME = '3600' OR PEVEMPL_ORGN_CODE_HOME = '2000')
  AND PEVEMPL_ORGN_CODE_HOME = FTVORGN_ORGN_CODE
ORDER BY FTVORGN_FMGR_CODE_PIDM||PEVEMPL_ORGN_CODE_HOME||PEVEMPL_FULL_NAME;

