select pm_task__new_task_item ( null, :project_item_id, '$task_title($i)', '$description($i)', to_timestamp(now(),'YYYY MM DD HH24 MI SS'), to_timestamp(now(),'YYYY MM DD HH24 MI SS'), '0', now(), :user_id, :peeraddr, :package_id ); select pm_task__new_task_revision ( :task_id, :project_item_id, :task_title, :description, to_timestamp(:start_date,'YYYY MM DD HH24 MI SS'), to_timestamp(:end_date,'YYYY MM DD HH24 MI SS'), :percent_complete, now(), :user_id, :peeraddr, :package_id ); select t.task_revision_id, t.title as task_title, t.item_id, t.description, t.name, t.parent_id, to_char(t.start_date,'YYYY MM DD') as start_date, to_char(t.end_date,'YYYY MM DD') as end_date, t.percent_complete FROM pm_tasks_revisionsx t, cr_items i WHERE t.item_id = :task_id and t.revision_id = i.live_revision