Friday 17 July 2009

Copying a pathcode? OL made easy

--  Copy pathcode 1 records to pathcode 2

accept PATHCODE_TO_REPLACE TEXT PROMPT 'Enter the pathcode you are replacing -> '
accept PATHCODE_TO_DUPLICATE TEXT PROMPT 'Enter the pathcode you are duplicating –> '

accept OLOWNER TEXT PROMPT 'Enter the pathcode you are duplicating -> '

create table f9861_temp as select * from &&OLOWNER..f9861 where sipathcd = '&PATHCODE_TO_DUPLICATE';

delete from f9861_temp where SISTCE != '1'

commit;

update f9861_temp set sipathcd = '&PATHCODE_TO_REPLACE';

commit;

delete from &&OLOWNER..f9861 where sipathcd = '&PATHCODE_TO_REPLACE';

commit;

insert into &&OLOWNER..f9861 select * from f9861_temp;

commit;

drop table f9861_temp;

No comments: