-- --ER/Studio 6.6 SQL Code Generation -- Company : ComPiere, Inc. -- Project : AD251h -- Author : Jorg Janke -- -- Date Created : Monday, February 07, 2005 16:11:18 -- Target DBMS : Oracle 10g -- ALTER TABLE I_BankStatement DROP CONSTRAINT CBankAccount_IBankStatement ; ALTER TABLE I_BankStatement DROP CONSTRAINT CBankStatement_IBankStatement ; ALTER TABLE I_BankStatement DROP CONSTRAINT CBankStmtLine_IBankStmt ; ALTER TABLE I_BankStatement DROP CONSTRAINT CBPartner_IBankStatement ; ALTER TABLE I_BankStatement DROP CONSTRAINT CCharge_IBankStmt ; ALTER TABLE I_BankStatement DROP CONSTRAINT CCurrency_IBankStatement ; ALTER TABLE I_BankStatement DROP CONSTRAINT CInvoice_IBankStatement ; ALTER TABLE I_BankStatement DROP CONSTRAINT CPayment_IbankStatement ; ALTER TABLE I_BPartner DROP CONSTRAINT ADUser_IBPartner ; ALTER TABLE I_BPartner DROP CONSTRAINT CBPartner_IBPartner ; ALTER TABLE I_BPartner DROP CONSTRAINT CBPartnerLocation_IBPartner ; ALTER TABLE I_BPartner DROP CONSTRAINT CBPGroup_IBPartner ; ALTER TABLE I_BPartner DROP CONSTRAINT CCountry_IPartner ; ALTER TABLE I_BPartner DROP CONSTRAINT CGreeting_IBPartner ; ALTER TABLE I_BPartner DROP CONSTRAINT CRegion_IBPartner ; ALTER TABLE I_Conversion_Rate DROP CONSTRAINT CConversionRate_IConvRate ; ALTER TABLE I_Conversion_Rate DROP CONSTRAINT CConvType_IConvRate ; ALTER TABLE I_Conversion_Rate DROP CONSTRAINT CCurrency_IConvRate ; ALTER TABLE I_Conversion_Rate DROP CONSTRAINT CCurrency_IConvRateTo ; ALTER TABLE I_ElementValue DROP CONSTRAINT ADColumn_IElementValue ; ALTER TABLE I_ElementValue DROP CONSTRAINT CElement_IElementValue ; ALTER TABLE I_ElementValue DROP CONSTRAINT CElementValue_IElementValue ; ALTER TABLE I_ElementValue DROP CONSTRAINT CEValueParent_IElementValue ; ALTER TABLE I_GLJournal DROP CONSTRAINT ADOrg_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT ADOrgDoc_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT ADOrgTrx_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CAcctSchema_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CActivity_GLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CBPartner_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CCampaign_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CConversionType_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CCurrency_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CDocType_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CElValueAccount_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CElValueUser2_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CEValueUser1_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CLocFrom_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CLocTo_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CPeriod_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CProject_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CSalesRegion_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT CValidCombination_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT GLBudget_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT GLCategory_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT GLJourbelLine_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT GLJournal_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT GLJournalBatch_IGLJournal ; ALTER TABLE I_GLJournal DROP CONSTRAINT MProduct_OGLJournal ; ALTER TABLE I_InOutLineConfirm DROP CONSTRAINT MInOutLineConfirm_Import ; ALTER TABLE I_Inventory DROP CONSTRAINT MInventory_IInventory ; ALTER TABLE I_Inventory DROP CONSTRAINT MInventoryLine_IInventory ; ALTER TABLE I_Inventory DROP CONSTRAINT MLocator_IInventory ; ALTER TABLE I_Inventory DROP CONSTRAINT MProduct_IInventory ; ALTER TABLE I_Inventory DROP CONSTRAINT MWarehouse_IInventory ; ALTER TABLE I_Invoice DROP CONSTRAINT ADOrg_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT ADOrgTrx_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT ADUser_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT ADUserSalesRep_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CActivity_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CBPartner_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CBPLocation_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CCampaign_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CCountry_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CCurrency_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CDocType_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CInvliceLine_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CInvoice_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CLocation_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CPaymentTerm_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CProject_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CRegion_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT CTax_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT MPriceList_IInvoice ; ALTER TABLE I_Invoice DROP CONSTRAINT NProduct_IInvoice ; ALTER TABLE I_Order DROP CONSTRAINT ADOrg_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT ADOrgTrx_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT ADUser_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT ADUserSalesRep_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CACtivity_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CBOLocation_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CBPartner_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CBPartnerLocBillTo_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CCampaign_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CCountry_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CCurrency_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CDocType_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CLocation_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT COrder_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT COrderLine_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CPaymentTerm_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CProject_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CRegion_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CTax_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT CUOM_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT MPriceList_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT MProduct_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT MShipper_IOrder ; ALTER TABLE I_Order DROP CONSTRAINT MWarehouse_IOrder ; ALTER TABLE I_Payment DROP CONSTRAINT CBankAccount_IPayment ; ALTER TABLE I_Payment DROP CONSTRAINT CBPartner_IPayment ; ALTER TABLE I_Payment DROP CONSTRAINT CCharge_IPayment ; ALTER TABLE I_Payment DROP CONSTRAINT CDocType_IPayment ; ALTER TABLE I_Payment DROP CONSTRAINT CInvoice_IPayment ; ALTER TABLE I_Payment DROP CONSTRAINT CPayment_IPayment ; ALTER TABLE I_Product DROP CONSTRAINT CBPartner_IProduct ; ALTER TABLE I_Product DROP CONSTRAINT CCurrency_IProduct ; ALTER TABLE I_Product DROP CONSTRAINT CUOM_IProduct ; ALTER TABLE I_Product DROP CONSTRAINT MProduct_IProduct ; ALTER TABLE I_Product DROP CONSTRAINT MProductCategory_IProduct ; ALTER TABLE I_ReportLine DROP CONSTRAINT CElementValue_IReportLine ; ALTER TABLE I_ReportLine DROP CONSTRAINT PAReportLine_IReportLine ; ALTER TABLE I_ReportLine DROP CONSTRAINT PAReportLineSet_IReportLine ; ALTER TABLE I_ReportLine DROP CONSTRAINT PAReportSource_IReportLine ; -- -- TABLE: I_BankStatement -- ALTER TABLE I_BankStatement ADD CONSTRAINT CBankAccount_IBankStatement FOREIGN KEY (C_BankAccount_ID) REFERENCES C_BankAccount(C_BankAccount_ID) ON DELETE SET NULL ; ALTER TABLE I_BankStatement ADD CONSTRAINT CBankStatement_IBankStatement FOREIGN KEY (C_BankStatement_ID) REFERENCES C_BankStatement(C_BankStatement_ID) ON DELETE SET NULL ; ALTER TABLE I_BankStatement ADD CONSTRAINT CBankStmtLine_IBankStmt FOREIGN KEY (C_BankStatementLine_ID) REFERENCES C_BankStatementLine(C_BankStatementLine_ID) ON DELETE SET NULL ; ALTER TABLE I_BankStatement ADD CONSTRAINT CBPartner_IBankStatement FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner(C_BPartner_ID) ON DELETE SET NULL ; ALTER TABLE I_BankStatement ADD CONSTRAINT CCharge_IBankStmt FOREIGN KEY (C_Charge_ID) REFERENCES C_Charge(C_Charge_ID) ON DELETE SET NULL ; ALTER TABLE I_BankStatement ADD CONSTRAINT CCurrency_IBankStatement FOREIGN KEY (C_Currency_ID) REFERENCES C_Currency(C_Currency_ID) ON DELETE SET NULL ; ALTER TABLE I_BankStatement ADD CONSTRAINT CInvoice_IBankStatement FOREIGN KEY (C_Invoice_ID) REFERENCES C_Invoice(C_Invoice_ID) ON DELETE SET NULL ; ALTER TABLE I_BankStatement ADD CONSTRAINT CPayment_IbankStatement FOREIGN KEY (C_Payment_ID) REFERENCES C_Payment(C_Payment_ID) ON DELETE SET NULL ; -- -- TABLE: I_BPartner -- ALTER TABLE I_BPartner ADD CONSTRAINT ADUser_IBPartner FOREIGN KEY (AD_User_ID) REFERENCES AD_User(AD_User_ID) ON DELETE SET NULL ; ALTER TABLE I_BPartner ADD CONSTRAINT CBPartner_IBPartner FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner(C_BPartner_ID) ON DELETE SET NULL ; ALTER TABLE I_BPartner ADD CONSTRAINT CBPartnerLocation_IBPartner FOREIGN KEY (C_BPartner_Location_ID) REFERENCES C_BPartner_Location(C_BPartner_Location_ID) ON DELETE SET NULL ; ALTER TABLE I_BPartner ADD CONSTRAINT CBPGroup_IBPartner FOREIGN KEY (C_BP_Group_ID) REFERENCES C_BP_Group(C_BP_Group_ID) ON DELETE SET NULL ; ALTER TABLE I_BPartner ADD CONSTRAINT CCountry_IPartner FOREIGN KEY (C_Country_ID) REFERENCES C_Country(C_Country_ID) ON DELETE SET NULL ; ALTER TABLE I_BPartner ADD CONSTRAINT CGreeting_IBPartner FOREIGN KEY (C_Greeting_ID) REFERENCES C_Greeting(C_Greeting_ID) ON DELETE SET NULL ; ALTER TABLE I_BPartner ADD CONSTRAINT CRegion_IBPartner FOREIGN KEY (C_Region_ID) REFERENCES C_Region(C_Region_ID) ON DELETE SET NULL ; -- -- TABLE: I_Conversion_Rate -- ALTER TABLE I_Conversion_Rate ADD CONSTRAINT CConversionRate_IConvRate FOREIGN KEY (C_Conversion_Rate_ID) REFERENCES C_Conversion_Rate(C_Conversion_Rate_ID) ON DELETE SET NULL ; ALTER TABLE I_Conversion_Rate ADD CONSTRAINT CConvType_IConvRate FOREIGN KEY (C_ConversionType_ID) REFERENCES C_ConversionType(C_ConversionType_ID) ON DELETE SET NULL ; ALTER TABLE I_Conversion_Rate ADD CONSTRAINT CCurrency_IConvRate FOREIGN KEY (C_Currency_ID) REFERENCES C_Currency(C_Currency_ID) ON DELETE SET NULL ; ALTER TABLE I_Conversion_Rate ADD CONSTRAINT CCurrency_IConvRateTo FOREIGN KEY (C_Currency_ID_To) REFERENCES C_Currency(C_Currency_ID) ON DELETE SET NULL ; -- -- TABLE: I_ElementValue -- ALTER TABLE I_ElementValue ADD CONSTRAINT ADColumn_IElementValue FOREIGN KEY (AD_Column_ID) REFERENCES AD_Column(AD_Column_ID) ON DELETE SET NULL ; ALTER TABLE I_ElementValue ADD CONSTRAINT CElement_IElementValue FOREIGN KEY (C_Element_ID) REFERENCES C_Element(C_Element_ID) ON DELETE SET NULL ; ALTER TABLE I_ElementValue ADD CONSTRAINT CElementValue_IElementValue FOREIGN KEY (C_ElementValue_ID) REFERENCES C_ElementValue(C_ElementValue_ID) ON DELETE SET NULL ; ALTER TABLE I_ElementValue ADD CONSTRAINT CEValueParent_IElementValue FOREIGN KEY (ParentElementValue_ID) REFERENCES C_ElementValue(C_ElementValue_ID) ON DELETE SET NULL ; -- -- TABLE: I_GLJournal -- ALTER TABLE I_GLJournal ADD CONSTRAINT ADOrg_IGLJournal FOREIGN KEY (AD_Org_ID) REFERENCES AD_Org(AD_Org_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT ADOrgDoc_IGLJournal FOREIGN KEY (AD_OrgDoc_ID) REFERENCES AD_Org(AD_Org_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT ADOrgTrx_IGLJournal FOREIGN KEY (AD_OrgTrx_ID) REFERENCES AD_Org(AD_Org_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CAcctSchema_IGLJournal FOREIGN KEY (C_AcctSchema_ID) REFERENCES C_AcctSchema(C_AcctSchema_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CActivity_GLJournal FOREIGN KEY (C_Activity_ID) REFERENCES C_Activity(C_Activity_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CBPartner_IGLJournal FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner(C_BPartner_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CCampaign_IGLJournal FOREIGN KEY (C_Campaign_ID) REFERENCES C_Campaign(C_Campaign_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CConversionType_IGLJournal FOREIGN KEY (C_ConversionType_ID) REFERENCES C_ConversionType(C_ConversionType_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CCurrency_IGLJournal FOREIGN KEY (C_Currency_ID) REFERENCES C_Currency(C_Currency_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CDocType_IGLJournal FOREIGN KEY (C_DocType_ID) REFERENCES C_DocType(C_DocType_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CElValueAccount_IGLJournal FOREIGN KEY (Account_ID) REFERENCES C_ElementValue(C_ElementValue_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CElValueUser2_IGLJournal FOREIGN KEY (User2_ID) REFERENCES C_ElementValue(C_ElementValue_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CEValueUser1_IGLJournal FOREIGN KEY (User1_ID) REFERENCES C_ElementValue(C_ElementValue_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CLocFrom_IGLJournal FOREIGN KEY (C_LocFrom_ID) REFERENCES C_Location(C_Location_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CLocTo_IGLJournal FOREIGN KEY (C_LocTo_ID) REFERENCES C_Location(C_Location_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CPeriod_IGLJournal FOREIGN KEY (C_Period_ID) REFERENCES C_Period(C_Period_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CProject_IGLJournal FOREIGN KEY (C_Project_ID) REFERENCES C_Project(C_Project_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CSalesRegion_IGLJournal FOREIGN KEY (C_SalesRegion_ID) REFERENCES C_SalesRegion(C_SalesRegion_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT CValidCombination_IGLJournal FOREIGN KEY (C_ValidCombination_ID) REFERENCES C_ValidCombination(C_ValidCombination_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT GLBudget_IGLJournal FOREIGN KEY (GL_Budget_ID) REFERENCES GL_Budget(GL_Budget_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT GLCategory_IGLJournal FOREIGN KEY (GL_Category_ID) REFERENCES GL_Category(GL_Category_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT GLJourbelLine_IGLJournal FOREIGN KEY (GL_JournalLine_ID) REFERENCES GL_JournalLine(GL_JournalLine_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT GLJournal_IGLJournal FOREIGN KEY (GL_Journal_ID) REFERENCES GL_Journal(GL_Journal_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT GLJournalBatch_IGLJournal FOREIGN KEY (GL_JournalBatch_ID) REFERENCES GL_JournalBatch(GL_JournalBatch_ID) ON DELETE SET NULL ; ALTER TABLE I_GLJournal ADD CONSTRAINT MProduct_OGLJournal FOREIGN KEY (M_Product_ID) REFERENCES M_Product(M_Product_ID) ON DELETE SET NULL ; -- -- TABLE: I_InOutLineConfirm -- ALTER TABLE I_InOutLineConfirm ADD CONSTRAINT MInOutLineConfirm_Import FOREIGN KEY (M_InOutLineConfirm_ID) REFERENCES M_InOutLineConfirm(M_InOutLineConfirm_ID) ON DELETE CASCADE ; -- -- TABLE: I_Inventory -- ALTER TABLE I_Inventory ADD CONSTRAINT MInventory_IInventory FOREIGN KEY (M_Inventory_ID) REFERENCES M_Inventory(M_Inventory_ID) ON DELETE SET NULL ; ALTER TABLE I_Inventory ADD CONSTRAINT MInventoryLine_IInventory FOREIGN KEY (M_InventoryLine_ID) REFERENCES M_InventoryLine(M_InventoryLine_ID) ON DELETE SET NULL ; ALTER TABLE I_Inventory ADD CONSTRAINT MLocator_IInventory FOREIGN KEY (M_Locator_ID) REFERENCES M_Locator(M_Locator_ID) ON DELETE SET NULL ; ALTER TABLE I_Inventory ADD CONSTRAINT MProduct_IInventory FOREIGN KEY (M_Product_ID) REFERENCES M_Product(M_Product_ID) ON DELETE SET NULL ; ALTER TABLE I_Inventory ADD CONSTRAINT MWarehouse_IInventory FOREIGN KEY (M_Warehouse_ID) REFERENCES M_Warehouse(M_Warehouse_ID) ON DELETE SET NULL ; -- -- TABLE: I_Invoice -- ALTER TABLE I_Invoice ADD CONSTRAINT ADOrg_IInvoice FOREIGN KEY (AD_Org_ID) REFERENCES AD_Org(AD_Org_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT ADOrgTrx_IInvoice FOREIGN KEY (AD_OrgTrx_ID) REFERENCES AD_Org(AD_Org_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT ADUser_IInvoice FOREIGN KEY (AD_User_ID) REFERENCES AD_User(AD_User_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT ADUserSalesRep_IInvoice FOREIGN KEY (SalesRep_ID) REFERENCES AD_User(AD_User_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CActivity_IInvoice FOREIGN KEY (C_Activity_ID) REFERENCES C_Activity(C_Activity_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CBPartner_IInvoice FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner(C_BPartner_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CBPLocation_IInvoice FOREIGN KEY (C_BPartner_Location_ID) REFERENCES C_BPartner_Location(C_BPartner_Location_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CCampaign_IInvoice FOREIGN KEY (C_Campaign_ID) REFERENCES C_Campaign(C_Campaign_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CCountry_IInvoice FOREIGN KEY (C_Country_ID) REFERENCES C_Country(C_Country_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CCurrency_IInvoice FOREIGN KEY (C_Currency_ID) REFERENCES C_Currency(C_Currency_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CDocType_IInvoice FOREIGN KEY (C_DocType_ID) REFERENCES C_DocType(C_DocType_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CInvliceLine_IInvoice FOREIGN KEY (C_InvoiceLine_ID) REFERENCES C_InvoiceLine(C_InvoiceLine_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CInvoice_IInvoice FOREIGN KEY (C_Invoice_ID) REFERENCES C_Invoice(C_Invoice_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CLocation_IInvoice FOREIGN KEY (C_Location_ID) REFERENCES C_Location(C_Location_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CPaymentTerm_IInvoice FOREIGN KEY (C_PaymentTerm_ID) REFERENCES C_PaymentTerm(C_PaymentTerm_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CProject_IInvoice FOREIGN KEY (C_Project_ID) REFERENCES C_Project(C_Project_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CRegion_IInvoice FOREIGN KEY (C_Region_ID) REFERENCES C_Region(C_Region_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT CTax_IInvoice FOREIGN KEY (C_Tax_ID) REFERENCES C_Tax(C_Tax_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT MPriceList_IInvoice FOREIGN KEY (M_PriceList_ID) REFERENCES M_PriceList(M_PriceList_ID) ON DELETE SET NULL ; ALTER TABLE I_Invoice ADD CONSTRAINT NProduct_IInvoice FOREIGN KEY (M_Product_ID) REFERENCES M_Product(M_Product_ID) ON DELETE SET NULL ; -- -- TABLE: I_Order -- ALTER TABLE I_Order ADD CONSTRAINT ADOrg_IOrder FOREIGN KEY (AD_Org_ID) REFERENCES AD_Org(AD_Org_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT ADOrgTrx_IOrder FOREIGN KEY (AD_OrgTrx_ID) REFERENCES AD_Org(AD_Org_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT ADUser_IOrder FOREIGN KEY (AD_User_ID) REFERENCES AD_User(AD_User_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT ADUserSalesRep_IOrder FOREIGN KEY (SalesRep_ID) REFERENCES AD_User(AD_User_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CACtivity_IOrder FOREIGN KEY (C_Activity_ID) REFERENCES C_Activity(C_Activity_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CBOLocation_IOrder FOREIGN KEY (C_BPartner_Location_ID) REFERENCES C_BPartner_Location(C_BPartner_Location_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CBPartner_IOrder FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner(C_BPartner_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CBPartnerLocBillTo_IOrder FOREIGN KEY (BillTo_ID) REFERENCES C_BPartner_Location(C_BPartner_Location_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CCampaign_IOrder FOREIGN KEY (C_Campaign_ID) REFERENCES C_Campaign(C_Campaign_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CCountry_IOrder FOREIGN KEY (C_Country_ID) REFERENCES C_Country(C_Country_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CCurrency_IOrder FOREIGN KEY (C_Currency_ID) REFERENCES C_Currency(C_Currency_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CDocType_IOrder FOREIGN KEY (C_DocType_ID) REFERENCES C_DocType(C_DocType_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CLocation_IOrder FOREIGN KEY (C_Location_ID) REFERENCES C_Location(C_Location_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT COrder_IOrder FOREIGN KEY (C_Order_ID) REFERENCES C_Order(C_Order_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT COrderLine_IOrder FOREIGN KEY (C_OrderLine_ID) REFERENCES C_OrderLine(C_OrderLine_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CPaymentTerm_IOrder FOREIGN KEY (C_PaymentTerm_ID) REFERENCES C_PaymentTerm(C_PaymentTerm_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CProject_IOrder FOREIGN KEY (C_Project_ID) REFERENCES C_Project(C_Project_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CRegion_IOrder FOREIGN KEY (C_Region_ID) REFERENCES C_Region(C_Region_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CTax_IOrder FOREIGN KEY (C_Tax_ID) REFERENCES C_Tax(C_Tax_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT CUOM_IOrder FOREIGN KEY (C_UOM_ID) REFERENCES C_UOM(C_UOM_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT MPriceList_IOrder FOREIGN KEY (M_PriceList_ID) REFERENCES M_PriceList(M_PriceList_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT MProduct_IOrder FOREIGN KEY (M_Product_ID) REFERENCES M_Product(M_Product_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT MShipper_IOrder FOREIGN KEY (M_Shipper_ID) REFERENCES M_Shipper(M_Shipper_ID) ON DELETE SET NULL ; ALTER TABLE I_Order ADD CONSTRAINT MWarehouse_IOrder FOREIGN KEY (M_Warehouse_ID) REFERENCES M_Warehouse(M_Warehouse_ID) ON DELETE SET NULL ; -- -- TABLE: I_Payment -- ALTER TABLE I_Payment ADD CONSTRAINT CBankAccount_IPayment FOREIGN KEY (C_BankAccount_ID) REFERENCES C_BankAccount(C_BankAccount_ID) ON DELETE SET NULL ; ALTER TABLE I_Payment ADD CONSTRAINT CBPartner_IPayment FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner(C_BPartner_ID) ON DELETE SET NULL ; ALTER TABLE I_Payment ADD CONSTRAINT CCharge_IPayment FOREIGN KEY (C_Charge_ID) REFERENCES C_Charge(C_Charge_ID) ON DELETE SET NULL ; ALTER TABLE I_Payment ADD CONSTRAINT CDocType_IPayment FOREIGN KEY (C_DocType_ID) REFERENCES C_DocType(C_DocType_ID) ON DELETE SET NULL ; ALTER TABLE I_Payment ADD CONSTRAINT CInvoice_IPayment FOREIGN KEY (C_Invoice_ID) REFERENCES C_Invoice(C_Invoice_ID) ON DELETE SET NULL ; ALTER TABLE I_Payment ADD CONSTRAINT CPayment_IPayment FOREIGN KEY (C_Payment_ID) REFERENCES C_Payment(C_Payment_ID) ON DELETE SET NULL ; -- -- TABLE: I_Product -- ALTER TABLE I_Product ADD CONSTRAINT CBPartner_IProduct FOREIGN KEY (C_BPartner_ID) REFERENCES C_BPartner(C_BPartner_ID) ON DELETE SET NULL ; ALTER TABLE I_Product ADD CONSTRAINT CCurrency_IProduct FOREIGN KEY (C_Currency_ID) REFERENCES C_Currency(C_Currency_ID) ON DELETE SET NULL ; ALTER TABLE I_Product ADD CONSTRAINT CUOM_IProduct FOREIGN KEY (C_UOM_ID) REFERENCES C_UOM(C_UOM_ID) ON DELETE SET NULL ; ALTER TABLE I_Product ADD CONSTRAINT MProduct_IProduct FOREIGN KEY (M_Product_ID) REFERENCES M_Product(M_Product_ID) ON DELETE SET NULL ; ALTER TABLE I_Product ADD CONSTRAINT MProductCategory_IProduct FOREIGN KEY (M_Product_Category_ID) REFERENCES M_Product_Category(M_Product_Category_ID) ON DELETE SET NULL ; -- -- TABLE: I_ReportLine -- ALTER TABLE I_ReportLine ADD CONSTRAINT CElementValue_IReportLine FOREIGN KEY (C_ElementValue_ID) REFERENCES C_ElementValue(C_ElementValue_ID) ON DELETE SET NULL ; ALTER TABLE I_ReportLine ADD CONSTRAINT PAReportLine_IReportLine FOREIGN KEY (PA_ReportLine_ID) REFERENCES PA_ReportLine(PA_ReportLine_ID) ON DELETE SET NULL ; ALTER TABLE I_ReportLine ADD CONSTRAINT PAReportLineSet_IReportLine FOREIGN KEY (PA_ReportLineSet_ID) REFERENCES PA_ReportLineSet(PA_ReportLineSet_ID) ON DELETE SET NULL ; ALTER TABLE I_ReportLine ADD CONSTRAINT PAReportSource_IReportLine FOREIGN KEY (PA_ReportSource_ID) REFERENCES PA_ReportSource(PA_ReportSource_ID) ON DELETE SET NULL ;