select * from r5actchecklists
WHERE
(
(<param.operatorchecklistcode> IS NOT NULL
AND ack_entitykey = <param.operatorchecklistcode>
AND ack_rentity = 'OPCK')
OR (
<param.workordernum> IS NOT NULL
AND ack_event = <param.workordernum>
AND ack_act = <param.activitytrade>)
)
AND ack_followup = '+'
AND ((ack_followupact IS NULL AND ack_followupevent IS NULL)
AND ack_defmaint IS NULL)
