
SELECT ksf_pk  ksf_pk,ksf_code ksf_code,ksf_hazard_desc ksf_hazard_desc,
(SELECT uco_desc FROM r5ucodes where uco_code = ksf_hazard_type and uco_rentity = 'HZTP') ksf_hazard_typedesc,
ksf_precaution_desc ksf_precaution_desc,
(SELECT uco_desc FROM r5ucodes where uco_code =  ksf_timing and uco_rentity = 'PCTI') ksf_timing_desc,
KSF_PRECAUTIONAPPLIED KSF_PRECAUTIONAPPLIED, (SELECT uco_desc FROM r5ucodes where uco_code = KSF_RESPONSIBILITY and uco_rentity = 'RESP') KSF_RESPONSIBILITY
FROM R5WORKSAFETY
WHERE ksf_code = <param.permittowork>
AND ksf_rentity = 'PTW'
ORDER BY KSF_RESPONSIBILITY ASC, ksf_timing_desc ASC, ksf_hazard_desc ASC, ksf_precaution_desc ASC


