oracle8.1.6
select a.action_id,
a.workflow_id,
a.sort_order,
a.short_name,
a.pretty_name,
a.pretty_past_tense,
a.edit_fields,
a.assigned_role,
(select short_name from workflow_roles where role_id = a.assigned_role) as assigned_role_short_name,
a.always_enabled_p,
(select case when count(*) = 1 then 't' else 'f' end
from workflow_initial_action
where workflow_id = a.workflow_id
and action_id = a.action_id
) as initial_action_p,
fa.new_state as new_state_id,
(select short_name from workflow_fsm_states where state_id = fa.new_state) as new_state,
a.description,
a.description_mime_type
from workflow_actions a,
workflow_fsm_actions fa
where a.workflow_id = :workflow_id
and fa.action_id = a.action_id
and a.action_id = fa.action_id (+)
order by a.sort_order
select nvl(max(sort_order),0) + 1
from workflow_action_callbacks
where action_id = :action_id
insert into workflow_action_allowed_roles
select :action_id,
(select role_id
from workflow_roles
where workflow_id = :workflow_id
and short_name = :allowed_role) as role_id
from dual