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

BEGIN

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

IF v_count = 0 THEN

EXECUTE IMMEDIATE 'alter table ITEMCLICOMPLEMENTO add CODIGOMOTIVODESCONTO int NULL';

END IF;

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

IF v_count = 0 THEN

EXECUTE IMMEDIATE 'alter table CONTROLEDESCONTO add CODPRO char(5) NULL';

END IF;

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

IF v_count = 0 THEN

EXECUTE IMMEDIATE 'alter table CONTROLEDESCONTO add ITEMPEDIDO int NULL';

END IF;


update DADOADICIONAL set RDOMINIO = 16024 where OID = 40514 AND RDOMINIO = 7;
commit;

END;