select i.latest_revision as task_id, t.parent_id as project_item_id
from cr_items i, pm_tasks_revisionsx t
where i.item_id = :task_item_id
and t.object_id = i.latest_revision
select title as task_title, description, mime_type as description_mime_type,
percent_complete, to_char(end_date,'YYYY-MM-DD') as task_end_date,
estimated_hours_work, estimated_hours_work_min,
estimated_hours_work_max, priority, dform
from pm_tasks_revisionsi
where object_id = :task_id
select item_id
from cr_revisions
where revision_id = :task_id
insert into pm_tasks
(task_id, task_number, status, process_instance)
values
(:task_item_id, 1, :status_id, :process_instance_id)
update pm_tasks
set status = :status_id
where task_id = :task_item_id