select count(*) from workflow_roles where workflow_id = :workflow_id and sort_order = :sort_order update workflow_roles set sort_order = sort_order + 1 where workflow_id = :workflow_id and sort_order >= :sort_order insert into workflow_roles (role_id, workflow_id, short_name, pretty_name, sort_order) values (:role_id, :workflow_id, :short_name, :pretty_name, :sort_order) select role_id from workflow_roles where workflow_id = :workflow_id and short_name = :short_name select role_id, workflow_id, short_name, pretty_name, sort_order from workflow_roles where role_id = :role_id select impl.impl_owner_name || '.' || impl.impl_name from acs_sc_impls impl, workflow_role_callbacks c where c.role_id = :role_id and impl.impl_id = c.acs_sc_impl_id order by c.sort_order select coalesce(max(sort_order),0) + 1 from workflow_role_callbacks where role_id = :role_id insert into workflow_role_callbacks (role_id, acs_sc_impl_id, sort_order) values (:role_id, :acs_sc_impl_id, :sort_order)