SELECT add_code, add_rentity, add_type, add_line, add_entity, add_rtype, add_text, add_created, add_user, add_lang
FROM r5addetails, r5tasks
WHERE add_rentity IN ('TASK', 'JBPL')
AND add_code = tsk_code || '#' || tsk_revision
AND tsk_revrstatus IN ('A', 'S')
AND ( (tsk_code = <parameter.taskcode> AND TSK_REVISION = <parameter.taskrevision> )
OR tsk_code IN (SELECT tpj_jobplan
FROM r5taskplanjobs WHERE tpj_task = <parameter.taskcode> AND tpj_taskrev = <parameter.taskrevision>))

