
/*------ ATD 405863 ------*/
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT Count(1) INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = OPICMRECOLHERLIFAND Upper(column_name) = 'FILIAL'; 
IF v_count = 0 THEN
BEGIN
EXECUTE IMMEDIATE 'ALTER TABLE OpICMRecolherLIF ADD Filial CHAR(2) default "  " not null '; 
EXECUTE IMMEDIATE 'UPDATE OpICMRecolherLIF SET Filial = "  " ';
EXECUTE IMMEDIATE 'alter table OpICMRecolherLIF drop CONSTRAINT PK_OPICMRECOLHERLIF';
EXECUTE IMMEDIATE 'alter table OpICMRecolherLIF ADD CONSTRAINT PK_OPICMRECOLHERLIF PRIMARY KEY (ESTADO,Filial)';
END;
END;
