select t.table_name from acs_object_types t where t.object_type = :object_type select a.attribute_id from acs_attributes a where a.object_type = :object_type and a.attribute_name = :attribute_name select a.object_type, a.attribute_name, case when a.storage = 'type_specific' then t.table_name else a.table_name end as table_name, coalesce(a.column_name, a.attribute_name) as column_name from acs_attributes a, acs_object_types t where a.attribute_id = :attribute_id and t.object_type = a.object_type select v.sort_order as old_sort_order from acs_enum_values v where v.attribute_id = :attribute_id and v.enum_value = :enum_value delete from acs_enum_values v where v.attribute_id = :attribute_id and v.enum_value = :enum_value update acs_enum_values v set v.sort_order = v.sort_order - 1 where v.attribute_id = :attribute_id and v.sort_order > :old_sort_order select object_type from acs_objects where object_id = :object_id select * from ($package_object_view) where object_id = :object_id select enum.pretty_name, enum.enum_value from acs_enum_values enum where enum.attribute_id = :attribute_id order by enum.sort_order insert into acs_enum_values (attribute_id, sort_order, enum_value, pretty_name) select :attribute_id, :sort_order, :enum_value, :enum_value from dual where not exists (select 1 from acs_enum_values v2 where v2.pretty_name = :enum_value and v2.attribute_id = :attribute_id) alter table $table_name drop column $attribute_name alter table $table_name add $attribute_name $sql_type