postgresql7.1
select tree_sortkey, item_id
from cr_items
where parent_id = etp__get_folder_id(:package_id)
and tree_sortkey < :sort_key
order by tree_sortkey desc
select tree_sortkey, item_id
from cr_items
where tree_sortkey >= :prev_sort_key
order by tree_sortkey
update cr_items
set tree_sortkey = :new_sortkey
where item_id = :item_id