oracle8.1.6
insert into portal_elements
(element_id, datasource_id, name, application_id,
page_id, region, state, sort_key, shadeable_p, hideable_p)
select :element_id,
:datasource_id,
:name,
:application_id,
:page_id,
:region,
:state,
nvl((select max(portal_elements.sort_key) + 1
from portal_elements
where page_id = :page_id
and region = :region), 1),
portal_datasources.shadeable_p,
portal_datasources.hideable_p
from portal_datasources
where portal_datasources.datasource_id = :datasource_id
insert into portal_element_parameters
(parameter_id, element_id, config_required_p, configured_p, key, value)
select portal_seq.nextval, :element_id, config_required_p, configured_p, key, value
from portal_datasource_parameters
where datasource_id = :datasource_id
insert into portal_element_parameters
(parameter_id, element_id, config_required_p, configured_p, key, value)
select portal_seq.nextval, :element_id, config_required_p, configured_p, key, value
from portal_element_parameters
where element_id = :template_element_id
select sort_key as other_sort_key,
element_id as other_element_id
from (select *
from portal_elements
where page_id = :page_id
and region = :region
and sort_key < :sort_key
and state != 'pinned'
order by sort_key desc)
where rownum = 1
select sort_key as other_sort_key,
element_id as other_element_id
from (select *
from portal_elements
where page_id = :page_id
and region = :region
and sort_key > :sort_key
and state != 'pinned'
order by sort_key asc)
where rownum = 1
update portal_elements
set region = :region,
sort_key = (select nvl((select max(sort_key) + 1
from portal_elements
where page_id = :page_id
and region = :region),
1)
from dual)
where element_id = :element_id
update portal_elements
set page_id = :page_id,
region = :region,
sort_key = (select nvl((select max(sort_key) + 1
from portal_elements
where page_id = :page_id
and region = :region),
1)
from dual)
where element_id = :element_id