/*todo 7046*/
/*modify constraint for ROUTESTOP_ID*/

begin
execute immediate ('alter table SORTBATCHCONTENTS
  drop constraint SORTBATCHCONTENTS_ROUTESTOP_ID ') ;
exception when others then null;
end;
/

begin
execute immediate ('alter table SORTBATCHCONTENTS
  add constraint SORTBATCHCONTENTS_ROUTESTOP_ID foreign key (ROUTESTOP_ID)
  references ROUTESTOP (ROUTESTOP_ID) on delete cascade') ;
exception when others then null;
end;
/
