/*------ ATD 408927 ------*/
DECLARE v_count NUMBER(1) := 0; 
BEGIN 
SELECT 1 INTO v_count FROM USER_TAB_COLUMNS WHERE Upper(table_name) = 'COMPLEMENTONFSAIDA' AND Upper(column_name) = 'FLAGDESPINCLUSANAOTRIBUTADA'; 
EXCEPTION 
WHEN NO_DATA_FOUND THEN 
EXECUTE IMMEDIATE 'ALTER TABLE COMPLEMENTONFSAIDA ADD FLAGDESPINCLUSANAOTRIBUTADA NUMERIC(1,0)'; 
END;

/*------ ATD 414045 ------*/
DECLARE v_count NUMBER:=0;

BEGIN

SELECT Count(1) INTO v_count FROM USER_TAB_COLUMNS WHERE UPPER(table_name) = 'PLATAFORMA_ECOMMERCE' and UPPER(column_name) = 'REGRAFILIALRETIRADA';

IF v_count = 0 THEN

EXECUTE IMMEDIATE 'ALTER TABLE PLATAFORMA_ECOMMERCE ADD REGRAFILIALRETIRADA NUMBER(1) DEFAULT 0 NOT NULL';

END IF;

END;