oracle8.1.6
select j.mail_job_id, j.mail_class_id, j.subject, j.state,
to_char(j.scheduled_date, 'YYYY-MM-DD HH24:MI') as execution_date
from ml_mail_jobs j, acs_named_objects o
where o.package_id = :package_id
and o.object_id = j.mail_job_id
and j.state in ('suspended', 'active')
and acs_permission.permission_p(j.mail_job_id, :user_id, 'admin') = 't'
order by j.scheduled_date, lower(subject)