--Conversion script

--update table, to make sure constraint can be added
update i_productlistpercustomer i
set    i.billingmethod = 3
where  i.billingmethod = 2
and    i.sizecode = '*';

commit;
  
-- Create/Recreate check constraints 
alter table I_PRODUCTLISTPERCUSTOMER
  add constraint CHK_PLPC_BILLMETHOD2
  check (sizecode <> '*' or billingmethod <>2   );  

--update table, to make sure constraint can be added
update i_productlistpercustomer i
set    i.changesperweek = 'Y'
where  i.changesperweek = 'N'
and    i.sizecode = '*'
and    i.billingmethod = 1;

commit;

-- Create/Recreate check constraints 
alter table I_PRODUCTLISTPERCUSTOMER
  add constraint CHK_PLPC_BILLMETHOD1
  check ( sizecode <> '*' or changesperweek <> 'N' or  billingmethod <> 1  );