-- order 20010647


ALTER TABLE USERDEFINEDRPT
	ADD (USEASINVOICEAPPENDIX VARCHAR2(1)  DEFAULT 'N' NOT NULL CONSTRAINT YN_ValidationField32 CHECK (USEASINVOICEAPPENDIX IN ('Y', 'N')));


ALTER TABLE INVOICEAPPENDIXDEFINITION ADD 
(
	USERDEFINEDRPT_ID    NUMBER NULL 
);


CREATE  INDEX XIF1INVOICEAPPENDIXDEFINITION ON INVOICEAPPENDIXDEFINITION
(USERDEFINEDRPT_ID     ASC)
TABLESPACE INDX;


ALTER TABLE INVOICEAPPENDIXDEFINITION
ADD CONSTRAINT INVOICEAPPENDIXDEF_USERDEFRPT FOREIGN KEY (USERDEFINEDRPT_ID) REFERENCES USERDEFINEDRPT (USERDEFINEDRPT_ID) ON DELETE CASCADE;



begin
execute immediate ('DROP SEQUENCE SEQ_INVOICEAPPENDIXDEFINITION');
exception when others then null;
end;
/


begin
execute immediate ('create sequence SEQ_INVOICEAPPENDIXDEFINITION  minvalue 1000 maxvalue 999999999999999999999999999 start with 1000 increment by 1');
exception when others then null;
end;
/