
/*------ ATD 277756 ------*/
DECLARE v_count NUMBER(1) := 0;   
BEGIN   SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'ALIQCREDITOICMS' AND Upper(column_name) = 'filial';   
EXCEPTION   WHEN NO_DATA_FOUND THEN   EXECUTE IMMEDIATE 'ALTER TABLE ALIQCREDITOICMS ADD FILIAL CHAR(2) DEFAULT '' ';  
 EXECUTE IMMEDIATE 'UPDATE ALIQCREDITOICMS set filial = '' where filial is null ';  
 END;
/*------ ATD 281180 ------*/
DECLARE v_count NUMBER:=0;   
BEGIN    SELECT Count(1) INTO v_count FROM USER_TAB_COLUMNS WHERE UPPER(table_name) = 'TABTRANFAT' AND Upper(COLUMN_NAME) = 'EMITEMDFE';   
IF v_count = 0 THEN    EXECUTE IMMEDIATE 'ALTER TABLE TABTRANFAT ADD EmiteMDFe NUMERIC(1) DEFAULT 0 CONSTRAINT DF_TABTRANFATEMITEMDFE NOT NULL';    
EXECUTE IMMEDIATE 'UPDATE TABTRANFAT SET EmiteMDFe = 1 ';    COMMIT;   
 END IF;   
 END;