/*
--                                                                              
-- PRIMARY KEYS --                                                              
--                                                                              
ALTER TABLE AD_ACCESSLOG ADD                                                    
CONSTRAINT AD_ACCESSLOG_KEY                                                     
PRIMARY KEY (                                                                   
AD_ACCESSLOG_ID                                                                 
);                                                                              
ALTER TABLE AD_ALERT ADD                                                        
CONSTRAINT AD_ALERT_KEY                                                         
PRIMARY KEY (                                                                   
AD_ALERT_ID                                                                     
);                                                                              
ALTER TABLE AD_ALERTPROCESSOR ADD                                               
CONSTRAINT AD_ALERTPROCESSOR_KEY                                                
PRIMARY KEY (                                                                   
AD_ALERTPROCESSOR_ID                                                            
);                                                                              
ALTER TABLE AD_ALERTPROCESSORLOG ADD                                            
CONSTRAINT AD_ALERTPROCESSORLOG_KEY                                             
PRIMARY KEY (                                                                   
AD_ALERTPROCESSOR_ID,                                                           
AD_ALERTPROCESSORLOG_ID                                                         
);                                                                              
ALTER TABLE AD_ALERTRECIPIENT ADD                                               
CONSTRAINT AD_ALTERTRECIPIENT_KEY                                               
PRIMARY KEY (                                                                   
AD_ALERTRECIPIENT_ID                                                            
);                                                                              
ALTER TABLE AD_ALERTRULE ADD                                                    
CONSTRAINT AD_ALERTRULE_KEY                                                     
PRIMARY KEY (                                                                   
AD_ALERTRULE_ID                                                                 
);                                                                              
ALTER TABLE AD_ARCHIVE ADD                                                      
CONSTRAINT AD_ARCHIVE_KEY                                                       
PRIMARY KEY (                                                                   
AD_ARCHIVE_ID                                                                   
);                                                                              
ALTER TABLE AD_ATTACHMENT ADD                                                   
CONSTRAINT AD_ATTACHMENT_KEY                                                    
PRIMARY KEY (                                                                   
AD_ATTACHMENT_ID                                                                
);                                                                              
ALTER TABLE AD_ATTACHMENTNOTE ADD                                               
CONSTRAINT AD_ATTACHMENTNOTE_KEY                                                
PRIMARY KEY (                                                                   
AD_ATTACHMENTNOTE_ID                                                            
);                                                                              
ALTER TABLE AD_ATTRIBUTE ADD                                                    
CONSTRAINT AD_ATTRIBUTE_KEY                                                     
PRIMARY KEY (                                                                   
AD_ATTRIBUTE_ID                                                                 
);                                                                              
ALTER TABLE AD_ATTRIBUTE_VALUE ADD                                              
CONSTRAINT AD_ATTRIBUTE_VALUE_KEY                                               
PRIMARY KEY (                                                                   
AD_ATTRIBUTE_ID,                                                                
RECORD_ID                                                                       
);                                                                              
ALTER TABLE AD_CHANGELOG ADD                                                    
CONSTRAINT AD_CHANGELOG_KEY                                                     
PRIMARY KEY (                                                                   
AD_CHANGELOG_ID,                                                                
AD_SESSION_ID,                                                                  
AD_TABLE_ID,                                                                    
AD_COLUMN_ID                                                                    
);                                                                              
ALTER TABLE AD_CLIENT ADD                                                       
CONSTRAINT AD_CLIENT_KEY                                                        
PRIMARY KEY (                                                                   
AD_CLIENT_ID                                                                    
);                                                                              
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT AD_CLIENTINFO_KEY                                                    
PRIMARY KEY (                                                                   
AD_CLIENT_ID                                                                    
);                                                                              
ALTER TABLE AD_COLOR ADD                                                        
CONSTRAINT AD_COLOR_KEY                                                         
PRIMARY KEY (                                                                   
AD_COLOR_ID                                                                     
);                                                                              
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT AD_COLUMN_KEY                                                        
PRIMARY KEY (                                                                   
AD_COLUMN_ID                                                                    
);                                                                              
ALTER TABLE AD_COLUMN_ACCESS ADD                                                
CONSTRAINT AD_COLUMN_ACCESS_KEY                                                 
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_COLUMN_ID                                                                    
);                                                                              
ALTER TABLE AD_COLUMN_TRL ADD                                                   
CONSTRAINT AD_COLUMN_TRL_KEY                                                    
PRIMARY KEY (                                                                   
AD_COLUMN_ID,                                                                   
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_DESKTOP ADD                                                      
CONSTRAINT AD_DESKTOP_KEY                                                       
PRIMARY KEY (                                                                   
AD_DESKTOP_ID                                                                   
);                                                                              
ALTER TABLE AD_DESKTOPWORKBENCH ADD                                             
CONSTRAINT AD_DESKTOPWORKBENCH_KEY                                              
PRIMARY KEY (                                                                   
AD_DESKTOPWORKBENCH_ID                                                          
);                                                                              
ALTER TABLE AD_DESKTOP_TRL ADD                                                  
CONSTRAINT AD_DESKTOP_TRL_KEY                                                   
PRIMARY KEY (                                                                   
AD_DESKTOP_ID,                                                                  
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_ELEMENT ADD                                                      
CONSTRAINT AD_ELEMENT_KEY                                                       
PRIMARY KEY (                                                                   
AD_ELEMENT_ID                                                                   
);                                                                              
ALTER TABLE AD_ELEMENT_TRL ADD                                                  
CONSTRAINT AD_ELEMENT_TRL_KEY                                                   
PRIMARY KEY (                                                                   
AD_ELEMENT_ID,                                                                  
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_ERROR ADD                                                        
CONSTRAINT AD_ERROR_KEY                                                         
PRIMARY KEY (                                                                   
AD_ERROR_ID                                                                     
);                                                                              
ALTER TABLE AD_FIELD ADD                                                        
CONSTRAINT AD_FIELD_KEY                                                         
PRIMARY KEY (                                                                   
AD_FIELD_ID                                                                     
);                                                                              
ALTER TABLE AD_FIELDGROUP ADD                                                   
CONSTRAINT AD_FIELDGROUP_ID                                                     
PRIMARY KEY (                                                                   
AD_FIELDGROUP_ID                                                                
);                                                                              
ALTER TABLE AD_FIELDGROUP_TRL ADD                                               
CONSTRAINT AD_FIELDGROUP_TRL_KEY                                                
PRIMARY KEY (                                                                   
AD_FIELDGROUP_ID,                                                               
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_FIELD_TRL ADD                                                    
CONSTRAINT AD_FIELD_TRL_KEY                                                     
PRIMARY KEY (                                                                   
AD_FIELD_ID,                                                                    
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_FIND ADD                                                         
CONSTRAINT AD_FIND_KEY                                                          
PRIMARY KEY (                                                                   
AD_FIND_ID                                                                      
);                                                                              
ALTER TABLE AD_FORM ADD                                                         
CONSTRAINT AD_FORM_KEY                                                          
PRIMARY KEY (                                                                   
AD_FORM_ID                                                                      
);                                                                              
ALTER TABLE AD_FORM_ACCESS ADD                                                  
CONSTRAINT AD_FORM_ACCESS_KEY                                                   
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_FORM_ID                                                                      
);                                                                              
ALTER TABLE AD_FORM_TRL ADD                                                     
CONSTRAINT AD_FORM_TRL_KEY                                                      
PRIMARY KEY (                                                                   
AD_FORM_ID,                                                                     
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_IMAGE ADD                                                        
CONSTRAINT AD_IMAGE_KEY                                                         
PRIMARY KEY (                                                                   
AD_IMAGE_ID                                                                     
);                                                                              
ALTER TABLE AD_IMPFORMAT ADD                                                    
CONSTRAINT AD_IMPFORMAT_KEY                                                     
PRIMARY KEY (                                                                   
AD_IMPFORMAT_ID                                                                 
);                                                                              
ALTER TABLE AD_IMPFORMAT_ROW ADD                                                
CONSTRAINT AD_IMPFORMAT_ROW_KEY                                                 
PRIMARY KEY (                                                                   
AD_IMPFORMAT_ROW_ID                                                             
);                                                                              
ALTER TABLE AD_LABELPRINTER ADD                                                 
CONSTRAINT AD_LABELPRINTER_KEY                                                  
PRIMARY KEY (                                                                   
AD_LABELPRINTER_ID                                                              
);                                                                              
ALTER TABLE AD_LABELPRINTERFUNCTION ADD                                         
CONSTRAINT AD_LABELPRINTERFUNCTION_KEY                                          
PRIMARY KEY (                                                                   
AD_LABELPRINTERFUNCTION_ID                                                      
);                                                                              
ALTER TABLE AD_LANGUAGE ADD                                                     
CONSTRAINT AD_LANGUAGE_KEY                                                      
PRIMARY KEY (                                                                   
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT AD_MENU_KEY                                                          
PRIMARY KEY (                                                                   
AD_MENU_ID                                                                      
);                                                                              
ALTER TABLE AD_MENU_TRL ADD                                                     
CONSTRAINT AD_MENU_TRL_KEY                                                      
PRIMARY KEY (                                                                   
AD_MENU_ID,                                                                     
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_MESSAGE ADD                                                      
CONSTRAINT AD_MESSAGE_KEY                                                       
PRIMARY KEY (                                                                   
AD_MESSAGE_ID                                                                   
);                                                                              
ALTER TABLE AD_MESSAGE_TRL ADD                                                  
CONSTRAINT AD_MESSAGE_TRL_KEY                                                   
PRIMARY KEY (                                                                   
AD_MESSAGE_ID,                                                                  
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_NOTE ADD                                                         
CONSTRAINT AD_NOTE_LEY                                                          
PRIMARY KEY (                                                                   
AD_NOTE_ID                                                                      
);                                                                              
ALTER TABLE AD_ORG ADD                                                          
CONSTRAINT AD_ORG_KEY                                                           
PRIMARY KEY (                                                                   
AD_ORG_ID                                                                       
);                                                                              
ALTER TABLE AD_ORGINFO ADD                                                      
CONSTRAINT AD_ORGINFO_KEY                                                       
PRIMARY KEY (                                                                   
AD_ORG_ID                                                                       
);                                                                              
ALTER TABLE AD_ORGTYPE ADD                                                      
CONSTRAINT AD_ORGTYPE_KEY                                                       
PRIMARY KEY (                                                                   
AD_ORGTYPE_ID                                                                   
);                                                                              
ALTER TABLE AD_PINSTANCE ADD                                                    
CONSTRAINT AD_PINSTANCE_KEY                                                     
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID                                                                 
);                                                                              
ALTER TABLE AD_PINSTANCE_LOG ADD                                                
CONSTRAINT AD_PINSTANCE_LOG_KEY                                                 
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
LOG_ID                                                                          
);                                                                              
ALTER TABLE AD_PINSTANCE_PARA ADD                                               
CONSTRAINT AD_PINSTANCE_PARA_KEY                                                
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
SEQNO                                                                           
);                                                                              
ALTER TABLE AD_PREFERENCE ADD                                                   
CONSTRAINT AD_PREFERENCE_KEY                                                    
PRIMARY KEY (                                                                   
AD_PREFERENCE_ID                                                                
);                                                                              
ALTER TABLE AD_PRINTCOLOR ADD                                                   
CONSTRAINT AD_PRINTCOLOR_KEY                                                    
PRIMARY KEY (                                                                   
AD_PRINTCOLOR_ID                                                                
);                                                                              
ALTER TABLE AD_PRINTFONT ADD                                                    
CONSTRAINT AD_PRINTFONT_KEY                                                     
PRIMARY KEY (                                                                   
AD_PRINTFONT_ID                                                                 
);                                                                              
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT AD_PRINTFORM_KEY                                                     
PRIMARY KEY (                                                                   
AD_PRINTFORM_ID                                                                 
);                                                                              
ALTER TABLE AD_PRINTFORMAT ADD                                                  
CONSTRAINT AD_PRINTFORMAT_KEY                                                   
PRIMARY KEY (                                                                   
AD_PRINTFORMAT_ID                                                               
);                                                                              
ALTER TABLE AD_PRINTFORMATITEM ADD                                              
CONSTRAINT AS_PRINTFORMATITEM_KEY                                               
PRIMARY KEY (                                                                   
AD_PRINTFORMATITEM_ID                                                           
);                                                                              
ALTER TABLE AD_PRINTFORMATITEM_TRL ADD                                          
CONSTRAINT AD_PRINTFORMATITEM_TRL_KEY                                           
PRIMARY KEY (                                                                   
AD_PRINTFORMATITEM_ID,                                                          
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_PRINTGRAPH ADD                                                   
CONSTRAINT AD_PRINTGRAPH_KEY                                                    
PRIMARY KEY (                                                                   
AD_PRINTGRAPH_ID                                                                
);                                                                              
ALTER TABLE AD_PRINTLABEL ADD                                                   
CONSTRAINT AD_PRINTLABEL_KEY                                                    
PRIMARY KEY (                                                                   
AD_PRINTLABEL_ID                                                                
);                                                                              
ALTER TABLE AD_PRINTLABELLINE ADD                                               
CONSTRAINT AD_PRINTLABELLINE_KEY                                                
PRIMARY KEY (                                                                   
AD_PRINTLABELLINE_ID                                                            
);                                                                              
ALTER TABLE AD_PRINTLABELLINE_TRL ADD                                           
CONSTRAINT AD_PRINTLABELLINETRL_KEY                                             
PRIMARY KEY (                                                                   
AD_PRINTLABELLINE_ID,                                                           
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_PRINTPAPER ADD                                                   
CONSTRAINT AD_PRINTPAPER_KEY                                                    
PRIMARY KEY (                                                                   
AD_PRINTPAPER_ID                                                                
);                                                                              
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT AD_PRINTTABLEFORMAT_KEY                                              
PRIMARY KEY (                                                                   
AD_PRINTTABLEFORMAT_ID                                                          
);                                                                              
ALTER TABLE AD_PRIVATE_ACCESS ADD                                               
CONSTRAINT AD_PRIVATE_ACCESS_KEY                                                
PRIMARY KEY (                                                                   
AD_USER_ID,                                                                     
AD_TABLE_ID,                                                                    
RECORD_ID                                                                       
);                                                                              
ALTER TABLE AD_PROCESS ADD                                                      
CONSTRAINT AD_PROCESS_KEY                                                       
PRIMARY KEY (                                                                   
AD_PROCESS_ID                                                                   
);                                                                              
ALTER TABLE AD_PROCESS_ACCESS ADD                                               
CONSTRAINT AD_PROCESS_ACCESS_KEY                                                
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_PROCESS_ID                                                                   
);                                                                              
ALTER TABLE AD_PROCESS_PARA ADD                                                 
CONSTRAINT AD_PROCESS_PARA_KEY                                                  
PRIMARY KEY (                                                                   
AD_PROCESS_PARA_ID                                                              
);                                                                              
ALTER TABLE AD_PROCESS_PARA_TRL ADD                                             
CONSTRAINT AD_PROCESS_PARAMETER_TRL_KEY                                         
PRIMARY KEY (                                                                   
AD_PROCESS_PARA_ID,                                                             
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_PROCESS_TRL ADD                                                  
CONSTRAINT AD_PROCESS_TRL_KEY                                                   
PRIMARY KEY (                                                                   
AD_PROCESS_ID,                                                                  
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_RECORD_ACCESS ADD                                                
CONSTRAINT AD_RECORD_ACCESS_KEY                                                 
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_TABLE_ID,                                                                    
RECORD_ID                                                                       
);                                                                              
ALTER TABLE AD_REFERENCE ADD                                                    
CONSTRAINT AD_REFEREMCE_KEY                                                     
PRIMARY KEY (                                                                   
AD_REFERENCE_ID                                                                 
);                                                                              
ALTER TABLE AD_REFERENCE_TRL ADD                                                
CONSTRAINT AD_REFERENCE_TRL_KEY                                                 
PRIMARY KEY (                                                                   
AD_REFERENCE_ID,                                                                
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_REF_LIST ADD                                                     
CONSTRAINT AD_REF_LIST_KEY                                                      
PRIMARY KEY (                                                                   
AD_REF_LIST_ID                                                                  
);                                                                              
ALTER TABLE AD_REF_LIST_TRL ADD                                                 
CONSTRAINT AD_REF_LIST_TRL_KEY                                                  
PRIMARY KEY (                                                                   
AD_REF_LIST_ID,                                                                 
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_REF_TABLE ADD                                                    
CONSTRAINT AD_REF_TABLE_KEY                                                     
PRIMARY KEY (                                                                   
AD_REFERENCE_ID                                                                 
);                                                                              
ALTER TABLE AD_REGISTRATION ADD                                                 
CONSTRAINT AD_REGISTRATION_KEY                                                  
PRIMARY KEY (                                                                   
AD_REGISTRATION_ID,                                                             
AD_CLIENT_ID,                                                                   
AD_SYSTEM_ID                                                                    
);                                                                              
ALTER TABLE AD_REPLICATION ADD                                                  
CONSTRAINT AD_REPLICATION_KEY                                                   
PRIMARY KEY (                                                                   
AD_REPLICATION_ID                                                               
);                                                                              
ALTER TABLE AD_REPLICATIONSTRATEGY ADD                                          
CONSTRAINT AD_REPLICATIONSTRATEGY                                               
PRIMARY KEY (                                                                   
AD_REPLICATIONSTRATEGY_ID                                                       
);                                                                              
ALTER TABLE AD_REPLICATIONTABLE ADD                                             
CONSTRAINT AD_REPLICATIONTABLE_KEY                                              
PRIMARY KEY (                                                                   
AD_REPLICATIONTABLE_ID                                                          
);                                                                              
ALTER TABLE AD_REPLICATION_LOG ADD                                              
CONSTRAINT AD_REPLICATION_LOG_KEY                                               
PRIMARY KEY (                                                                   
AD_REPLICATION_LOG_ID                                                           
);                                                                              
ALTER TABLE AD_REPLICATION_RUN ADD                                              
CONSTRAINT AD_REPLICATION_RUN_KEY                                               
PRIMARY KEY (                                                                   
AD_REPLICATION_RUN_ID                                                           
);                                                                              
ALTER TABLE AD_REPORTVIEW ADD                                                   
CONSTRAINT AD_REPORTVIEW_KEY                                                    
PRIMARY KEY (                                                                   
AD_REPORTVIEW_ID                                                                
);                                                                              
ALTER TABLE AD_REPORTVIEW_COL ADD                                               
CONSTRAINT AD_REPORTVIEW_COL_KEY                                                
PRIMARY KEY (                                                                   
AD_REPORTVIEW_COL_ID                                                            
);                                                                              
ALTER TABLE AD_ROLE ADD                                                         
CONSTRAINT AD_ROLE_KEY                                                          
PRIMARY KEY (                                                                   
AD_ROLE_ID                                                                      
);                                                                              
ALTER TABLE AD_ROLE_ORGACCESS ADD                                               
CONSTRAINT AD_ROLE_ORGACCESS_KEY                                                
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_ORG_ID                                                                       
);                                                                              
ALTER TABLE AD_SCHEDULER ADD                                                    
CONSTRAINT AD_SCHEDULER_KEY                                                     
PRIMARY KEY (                                                                   
AD_SCHEDULER_ID                                                                 
);                                                                              
ALTER TABLE AD_SCHEDULERLOG ADD                                                 
CONSTRAINT AD_SCHEDULERLOG_KEY                                                  
PRIMARY KEY (                                                                   
AD_SCHEDULER_ID,                                                                
AD_SCHEDULERLOG_ID                                                              
);                                                                              
ALTER TABLE AD_SCHEDULERRECIPIENT ADD                                           
CONSTRAINT AD_SCHEDULERRECIPIENT_KEY                                            
PRIMARY KEY (                                                                   
AD_SCHEDULERRECIPIENT_ID                                                        
);                                                                              
ALTER TABLE AD_SCHEDULER_PARA ADD                                               
CONSTRAINT AD_SCHEDULER_PARA_KEY                                                
PRIMARY KEY (                                                                   
AD_SCHEDULER_ID,                                                                
AD_PROCESS_PARA_ID                                                              
);                                                                              
ALTER TABLE AD_SEQUENCE ADD                                                     
CONSTRAINT AD_SEQUENCE_KEY                                                      
PRIMARY KEY (                                                                   
AD_SEQUENCE_ID                                                                  
);                                                                              
ALTER TABLE AD_SEQUENCE_AUDIT ADD                                               
CONSTRAINT AD_SEQUENCE_AUDIT_KEY                                                
PRIMARY KEY (                                                                   
AD_SEQUENCE_ID,                                                                 
DOCUMENTNO                                                                      
);                                                                              
ALTER TABLE AD_SEQUENCE_NO ADD                                                  
CONSTRAINT AD_SEQUENCE_NO_KEY                                                   
PRIMARY KEY (                                                                   
AD_SEQUENCE_ID,                                                                 
YEAR                                                                            
);                                                                              
ALTER TABLE AD_SESSION ADD                                                      
CONSTRAINT AD_SESSION_KEY                                                       
PRIMARY KEY (                                                                   
AD_SESSION_ID                                                                   
);                                                                              
ALTER TABLE AD_SYSTEM ADD                                                       
CONSTRAINT AD_SYSTEM_KEY                                                        
PRIMARY KEY (                                                                   
AD_SYSTEM_ID,                                                                   
AD_CLIENT_ID                                                                    
);                                                                              
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT AD_TAB_KEY                                                           
PRIMARY KEY (                                                                   
AD_TAB_ID                                                                       
);                                                                              
ALTER TABLE AD_TABLE ADD                                                        
CONSTRAINT AD_TABLE_KEY                                                         
PRIMARY KEY (                                                                   
AD_TABLE_ID                                                                     
);                                                                              
ALTER TABLE AD_TABLE_ACCESS ADD                                                 
CONSTRAINT AD_TABLE_ACCESS_KEY                                                  
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_TABLE_ID,                                                                    
ACCESSTYPERULE                                                                  
);                                                                              
ALTER TABLE AD_TABLE_TRL ADD                                                    
CONSTRAINT AD_TABLE_TRL_KEY                                                     
PRIMARY KEY (                                                                   
AD_TABLE_ID,                                                                    
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_TAB_TRL ADD                                                      
CONSTRAINT AD_TAB_TRL_KEY                                                       
PRIMARY KEY (                                                                   
AD_TAB_ID,                                                                      
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_TASK ADD                                                         
CONSTRAINT AD_TASK_KEY                                                          
PRIMARY KEY (                                                                   
AD_TASK_ID                                                                      
);                                                                              
ALTER TABLE AD_TASKINSTANCE ADD                                                 
CONSTRAINT AD_TASKINSTANCE_KEY                                                  
PRIMARY KEY (                                                                   
AD_TASKINSTANCE_ID                                                              
);                                                                              
ALTER TABLE AD_TASK_ACCESS ADD                                                  
CONSTRAINT AD_TASK_ACCESS_KEY                                                   
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_TASK_ID                                                                      
);                                                                              
ALTER TABLE AD_TASK_TRL ADD                                                     
CONSTRAINT AD_TASK_TRL_KEY                                                      
PRIMARY KEY (                                                                   
AD_TASK_ID,                                                                     
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_TREE ADD                                                         
CONSTRAINT AD_TREE_KEY                                                          
PRIMARY KEY (                                                                   
AD_TREE_ID                                                                      
);                                                                              
ALTER TABLE AD_TREEBAR ADD                                                      
CONSTRAINT AD_TREEBAR_KEY                                                       
PRIMARY KEY (                                                                   
AD_TREE_ID,                                                                     
AD_USER_ID,                                                                     
NODE_ID                                                                         
);                                                                              
ALTER TABLE AD_TREENODE ADD                                                     
CONSTRAINT AD_TREENODE_KEY                                                      
PRIMARY KEY (                                                                   
AD_TREE_ID,                                                                     
NODE_ID                                                                         
);                                                                              
ALTER TABLE AD_TREENODEBP ADD                                                   
CONSTRAINT AD_TREENODEBP_KEY                                                    
PRIMARY KEY (                                                                   
AD_TREE_ID,                                                                     
NODE_ID                                                                         
);                                                                              
ALTER TABLE AD_TREENODEMM ADD                                                   
CONSTRAINT AD_TREENODEMM_KEY                                                    
PRIMARY KEY (                                                                   
AD_TREE_ID,                                                                     
NODE_ID                                                                         
);                                                                              
ALTER TABLE AD_TREENODEPR ADD                                                   
CONSTRAINT AD_TREENODEPR_KEY                                                    
PRIMARY KEY (                                                                   
AD_TREE_ID,                                                                     
NODE_ID                                                                         
);                                                                              
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT AD_USER_KEY                                                          
PRIMARY KEY (                                                                   
AD_USER_ID                                                                      
);                                                                              
ALTER TABLE AD_USERDEF_FIELD ADD                                                
CONSTRAINT AD_USERDEF_FIELD_KEY                                                 
PRIMARY KEY (                                                                   
AD_USERDEF_FIELD_ID                                                             
);                                                                              
ALTER TABLE AD_USERDEF_TAB ADD                                                  
CONSTRAINT AD_USERDEF_TAB_KEY                                                   
PRIMARY KEY (                                                                   
AD_USERDEF_TAB_ID                                                               
);                                                                              
ALTER TABLE AD_USERDEF_WIN ADD                                                  
CONSTRAINT AD_USERDEF_WIN_KEY                                                   
PRIMARY KEY (                                                                   
AD_USERDEF_WIN_ID                                                               
);                                                                              
ALTER TABLE AD_USERMAIL ADD                                                     
CONSTRAINT AD_USERMAIL_KEY                                                      
PRIMARY KEY (                                                                   
AD_USERMAIL_ID                                                                  
);                                                                              
ALTER TABLE AD_USER_ORGACCESS ADD                                               
CONSTRAINT AD_USER_ORGACCESS                                                    
PRIMARY KEY (                                                                   
AD_USER_ID,                                                                     
AD_ORG_ID                                                                       
);                                                                              
ALTER TABLE AD_USER_ROLES ADD                                                   
CONSTRAINT AD_USER_ROLE_KEY                                                     
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_USER_ID                                                                      
);                                                                              
ALTER TABLE AD_USER_SUBSTITUTE ADD                                              
CONSTRAINT AD_USER_SUBSTITUTE_KEY                                               
PRIMARY KEY (                                                                   
AD_USER_SUBSTITUTE_ID                                                           
);                                                                              
ALTER TABLE AD_VAL_RULE ADD                                                     
CONSTRAINT AD_VAL_RULE_KEY                                                      
PRIMARY KEY (                                                                   
AD_VAL_RULE_ID                                                                  
);                                                                              
ALTER TABLE AD_WF_ACTIVITY ADD                                                  
CONSTRAINT AD_WF_ACTIVITY_KEY                                                   
PRIMARY KEY (                                                                   
AD_WF_ACTIVITY_ID                                                               
);                                                                              
ALTER TABLE AD_WF_ACTIVITYRESULT ADD                                            
CONSTRAINT AD_WF_ACTIVITYRESULT                                                 
PRIMARY KEY (                                                                   
AD_WF_ACTIVITYRESULT_ID                                                         
);                                                                              
ALTER TABLE AD_WF_BLOCK ADD                                                     
CONSTRAINT AD_WF_BLOCK_KEY                                                      
PRIMARY KEY (                                                                   
AD_WF_BLOCK_ID                                                                  
);                                                                              
ALTER TABLE AD_WF_EVENTAUDIT ADD                                                
CONSTRAINT AD_WF_EVENTAUDIT_KEY                                                 
PRIMARY KEY (                                                                   
AD_WF_EVENTAUDIT_ID                                                             
);                                                                              
ALTER TABLE AD_WF_NEXTCONDITION ADD                                             
CONSTRAINT AD_WF_NEXTCONDITION_KEY                                              
PRIMARY KEY (                                                                   
AD_WF_NEXTCONDITION_ID                                                          
);                                                                              
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT AD_WF_NODE_KEY                                                       
PRIMARY KEY (                                                                   
AD_WF_NODE_ID                                                                   
);                                                                              
ALTER TABLE AD_WF_NODENEXT ADD                                                  
CONSTRAINT AD_WF_NODENEXT_KEY                                                   
PRIMARY KEY (                                                                   
AD_WF_NODENEXT_ID                                                               
);                                                                              
ALTER TABLE AD_WF_NODE_PARA ADD                                                 
CONSTRAINT AD_WF_NODE_PARA_KEY                                                  
PRIMARY KEY (                                                                   
AD_WF_NODE_PARA_ID                                                              
);                                                                              
ALTER TABLE AD_WF_NODE_TRL ADD                                                  
CONSTRAINT AD_WF_NODE_TRL_KEY                                                   
PRIMARY KEY (                                                                   
AD_WF_NODE_ID,                                                                  
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_WF_PROCESS ADD                                                   
CONSTRAINT AD_WF_PROCESS_KEY                                                    
PRIMARY KEY (                                                                   
AD_WF_PROCESS_ID                                                                
);                                                                              
ALTER TABLE AD_WF_PROCESSDATA ADD                                               
CONSTRAINT AD_WF_PROCESSDATA_KEY                                                
PRIMARY KEY (                                                                   
AD_WF_PROCESSDATA_ID                                                            
);                                                                              
ALTER TABLE AD_WF_RESPONSIBLE ADD                                               
CONSTRAINT AD_WF_RESPONSIBLE_KEY                                                
PRIMARY KEY (                                                                   
AD_WF_RESPONSIBLE_ID                                                            
);                                                                              
ALTER TABLE AD_WINDOW ADD                                                       
CONSTRAINT AD_WINDOW_KEY                                                        
PRIMARY KEY (                                                                   
AD_WINDOW_ID                                                                    
);                                                                              
ALTER TABLE AD_WINDOW_ACCESS ADD                                                
CONSTRAINT AD_WINDOW_ACCESS_KEY                                                 
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_WINDOW_ID                                                                    
);                                                                              
ALTER TABLE AD_WINDOW_TRL ADD                                                   
CONSTRAINT AD_WINDOW_TRL_KEY                                                    
PRIMARY KEY (                                                                   
AD_WINDOW_ID,                                                                   
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_WORKBENCH ADD                                                    
CONSTRAINT AD_WORKBENCH_KEY                                                     
PRIMARY KEY (                                                                   
AD_WORKBENCH_ID                                                                 
);                                                                              
ALTER TABLE AD_WORKBENCHWINDOW ADD                                              
CONSTRAINT AD_WORKBENCHWINDOW_KEY                                               
PRIMARY KEY (                                                                   
AD_WORKBENCHWINDOW_ID                                                           
);                                                                              
ALTER TABLE AD_WORKBENCH_TRL ADD                                                
CONSTRAINT AD_WORKBENCH_TRL_KEY                                                 
PRIMARY KEY (                                                                   
AD_WORKBENCH_ID,                                                                
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE AD_WORKFLOW ADD                                                     
CONSTRAINT AD_WORKFLOW_KEY                                                      
PRIMARY KEY (                                                                   
AD_WORKFLOW_ID                                                                  
);                                                                              
ALTER TABLE AD_WORKFLOWPROCESSOR ADD                                            
CONSTRAINT AD_WORKFLOWPROCESSOR_KEY                                             
PRIMARY KEY (                                                                   
AD_WORKFLOWPROCESSOR_ID                                                         
);                                                                              
ALTER TABLE AD_WORKFLOWPROCESSORLOG ADD                                         
CONSTRAINT AD_WORKFLOWPROCESSORLOG_KEY                                          
PRIMARY KEY (                                                                   
AD_WORKFLOWPROCESSOR_ID,                                                        
AD_WORKFLOWPROCESSORLOG_ID                                                      
);                                                                              
ALTER TABLE AD_WORKFLOW_ACCESS ADD                                              
CONSTRAINT AD_WORKFLOW_ACCESS_KEY                                               
PRIMARY KEY (                                                                   
AD_ROLE_ID,                                                                     
AD_WORKFLOW_ID                                                                  
);                                                                              
ALTER TABLE AD_WORKFLOW_TRL ADD                                                 
CONSTRAINT AD_WORKFLOW_TRL_KEY                                                  
PRIMARY KEY (                                                                   
AD_WORKFLOW_ID,                                                                 
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT A_ASSET_KEY                                                          
PRIMARY KEY (                                                                   
A_ASSET_ID                                                                      
);                                                                              
ALTER TABLE A_ASSET_ACCT ADD                                                    
CONSTRAINT A_ASSET_ACCT_KEY                                                     
PRIMARY KEY (                                                                   
A_ASSET_ID,                                                                     
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE A_ASSET_ADDITION ADD                                                
CONSTRAINT A_ASSET_ADDITION_KEY                                                 
PRIMARY KEY (                                                                   
A_ASSET_ADDITION_ID                                                             
);                                                                              
ALTER TABLE A_ASSET_CHANGE ADD                                                  
CONSTRAINT A_ASSET_CHANGE_KEY                                                   
PRIMARY KEY (                                                                   
A_ASSET_CHANGE_ID                                                               
);                                                                              
ALTER TABLE A_ASSET_CHANGE_AMT ADD                                              
CONSTRAINT A_ASSET_CHANGE_AMT_KEY                                               
PRIMARY KEY (                                                                   
A_ASSET_CHANGE_ID,                                                              
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE A_ASSET_DELIVERY ADD                                                
CONSTRAINT A_ASSET_DELIVERY_KEY                                                 
PRIMARY KEY (                                                                   
A_ASSET_DELIVERY_ID                                                             
);                                                                              
ALTER TABLE A_ASSET_GROUP ADD                                                   
CONSTRAINT A_ASSET_GROUP_KEY                                                    
PRIMARY KEY (                                                                   
A_ASSET_GROUP_ID                                                                
);                                                                              
ALTER TABLE A_ASSET_GROUP_ACCT ADD                                              
CONSTRAINT A_ASSET_GROUP_ACCT_KEY                                               
PRIMARY KEY (                                                                   
A_ASSET_GROUP_ID,                                                               
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE A_ASSET_RETIREMENT ADD                                              
CONSTRAINT A_ASSET_RETIREMENT_KEY                                               
PRIMARY KEY (                                                                   
A_ASSET_RETIREMENT_ID                                                           
);                                                                              
ALTER TABLE A_ASSET_USE ADD                                                     
CONSTRAINT A_ASSET_USE_KEY                                                      
PRIMARY KEY (                                                                   
A_ASSET_USE_ID                                                                  
);                                                                              
ALTER TABLE A_DEPRECIATION ADD                                                  
CONSTRAINT A_DEPRECIATION_KEY                                                   
PRIMARY KEY (                                                                   
A_DEPRECIATION_ID                                                               
);                                                                              
ALTER TABLE A_REGISTRATION ADD                                                  
CONSTRAINT A_REGISTRATION_KEY                                                   
PRIMARY KEY (                                                                   
A_REGISTRATION_ID                                                               
);                                                                              
ALTER TABLE A_REGISTRATIONATTRIBUTE ADD                                         
CONSTRAINT A_REGISTRATIONATTRIBUTE_KEY                                          
PRIMARY KEY (                                                                   
A_REGISTRATIONATTRIBUTE_ID                                                      
);                                                                              
ALTER TABLE A_REGISTRATIONPRODUCT ADD                                           
CONSTRAINT A_REGISTRATIONPRODUCT_KEY                                            
PRIMARY KEY (                                                                   
A_REGISTRATIONATTRIBUTE_ID,                                                     
M_PRODUCT_ID                                                                    
);                                                                              
ALTER TABLE A_REGISTRATIONVALUE ADD                                             
CONSTRAINT A_REGISTRATIONVALUE_KEY                                              
PRIMARY KEY (                                                                   
A_REGISTRATION_ID,                                                              
A_REGISTRATIONATTRIBUTE_ID                                                      
);                                                                              
ALTER TABLE B_BID ADD                                                           
CONSTRAINT B_BID_KEY                                                            
PRIMARY KEY (                                                                   
B_BID_ID                                                                        
);                                                                              
ALTER TABLE B_BIDCOMMENT ADD                                                    
CONSTRAINT B_BIDCOMMENT_KEY                                                     
PRIMARY KEY (                                                                   
B_TOPIC_ID,                                                                     
B_BIDCOMMENT_ID                                                                 
);                                                                              
ALTER TABLE B_BUYER ADD                                                         
CONSTRAINT B_BUYER_KEY                                                          
PRIMARY KEY (                                                                   
AD_USER_ID                                                                      
);                                                                              
ALTER TABLE B_BUYERFUNDS ADD                                                    
CONSTRAINT B_BUYSERFUNDS_KEY                                                    
PRIMARY KEY (                                                                   
B_BUYERFUNDS_ID                                                                 
);                                                                              
ALTER TABLE B_OFFER ADD                                                         
CONSTRAINT B_OFFER_KEY                                                          
PRIMARY KEY (                                                                   
B_OFFER_ID                                                                      
);                                                                              
ALTER TABLE B_SELLER ADD                                                        
CONSTRAINT B_SELLER_KEY                                                         
PRIMARY KEY (                                                                   
AD_USER_ID                                                                      
);                                                                              
ALTER TABLE B_SELLERFUNDS ADD                                                   
CONSTRAINT B_SELLERFUNDS_KEY                                                    
PRIMARY KEY (                                                                   
B_SELLERFUNDS_ID                                                                
);                                                                              
ALTER TABLE B_TOPIC ADD                                                         
CONSTRAINT B_TOPIC_KEY                                                          
PRIMARY KEY (                                                                   
B_TOPIC_ID                                                                      
);                                                                              
ALTER TABLE B_TOPICCATEGORY ADD                                                 
CONSTRAINT B_TOPICCATEGORY_KEY                                                  
PRIMARY KEY (                                                                   
B_TOPICCATEGORY_ID                                                              
);                                                                              
ALTER TABLE B_TOPICTYPE ADD                                                     
CONSTRAINT B_TOPICTYPE_KEY                                                      
PRIMARY KEY (                                                                   
B_TOPICTYPE_ID                                                                  
);                                                                              
ALTER TABLE C_ACCTPROCESSOR ADD                                                 
CONSTRAINT C_ACCTPROCESSOR_KEY                                                  
PRIMARY KEY (                                                                   
C_ACCTPROCESSOR_ID                                                              
);                                                                              
ALTER TABLE C_ACCTPROCESSORLOG ADD                                              
CONSTRAINT C_ACCTPROCESSORLOG_KEY                                               
PRIMARY KEY (                                                                   
C_ACCTPROCESSOR_ID,                                                             
C_ACCTPROCESSORLOG_ID                                                           
);                                                                              
ALTER TABLE C_ACCTSCHEMA ADD                                                    
CONSTRAINT C_ACCTSCHEMA_KEY                                                     
PRIMARY KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT C_ACCTSCHEMA_DEFAULT_KEY                                             
PRIMARY KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT C_ACCTSCHEMA_ELEMENT_KEY                                             
PRIMARY KEY (                                                                   
C_ACCTSCHEMA_ELEMENT_ID                                                         
);                                                                              
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT C_ACCTSCHEMA_GL_KEY                                                  
PRIMARY KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_ACTIVITY ADD                                                      
CONSTRAINT C_ACTIVITY_KEY                                                       
PRIMARY KEY (                                                                   
C_ACTIVITY_ID                                                                   
);                                                                              
ALTER TABLE C_ALLOCATIONHDR ADD                                                 
CONSTRAINT C_ALLOCATION_KEY                                                     
PRIMARY KEY (                                                                   
C_ALLOCATIONHDR_ID                                                              
);                                                                              
ALTER TABLE C_ALLOCATIONLINE ADD                                                
CONSTRAINT C_ALLOCATIONLINE_KEY                                                 
PRIMARY KEY (                                                                   
C_ALLOCATIONLINE_ID                                                             
);                                                                              
ALTER TABLE C_BANK ADD                                                          
CONSTRAINT C_BANK_KEY                                                           
PRIMARY KEY (                                                                   
C_BANK_ID                                                                       
);                                                                              
ALTER TABLE C_BANKACCOUNT ADD                                                   
CONSTRAINT C_BANKACCOUNT_KEY                                                    
PRIMARY KEY (                                                                   
C_BANKACCOUNT_ID                                                                
);                                                                              
ALTER TABLE C_BANKACCOUNTDOC ADD                                                
CONSTRAINT C_BANKACCOUNTDOC_KEY                                                 
PRIMARY KEY (                                                                   
C_BANKACCOUNTDOC_ID                                                             
);                                                                              
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT C_BANKACCOUNT_ACCT_KEY                                               
PRIMARY KEY (                                                                   
C_BANKACCOUNT_ID,                                                               
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_BANKSTATEMENT ADD                                                 
CONSTRAINT C_BANKSTATEMENT_KEY                                                  
PRIMARY KEY (                                                                   
C_BANKSTATEMENT_ID                                                              
);                                                                              
ALTER TABLE C_BANKSTATEMENTLINE ADD                                             
CONSTRAINT C_BANKSTATEMENTLINE_KEY                                              
PRIMARY KEY (                                                                   
C_BANKSTATEMENTLINE_ID                                                          
);                                                                              
ALTER TABLE C_BANKSTATEMENTLOADER ADD                                           
CONSTRAINT C_BANKSTATEMENTLOADER_KEY                                            
PRIMARY KEY (                                                                   
C_BANKSTATEMENTLOADER_ID                                                        
);                                                                              
ALTER TABLE C_BANKSTATEMENTMATCHER ADD                                          
CONSTRAINT C_BANKSTATEMENTMATCHER_KEY                                           
PRIMARY KEY (                                                                   
C_BANKSTATEMENTMATCHER_ID                                                       
);                                                                              
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT C_BPARTNER_KEY                                                       
PRIMARY KEY (                                                                   
C_BPARTNER_ID                                                                   
);                                                                              
ALTER TABLE C_BPARTNER_LOCATION ADD                                             
CONSTRAINT C_BPARTNER_LOCATION_KEY                                              
PRIMARY KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
);                                                                              
ALTER TABLE C_BPARTNER_PRODUCT ADD                                              
CONSTRAINT C_BPARTNER_PRODUCT_KEY                                               
PRIMARY KEY (                                                                   
C_BPARTNER_ID,                                                                  
M_PRODUCT_ID                                                                    
);                                                                              
ALTER TABLE C_BP_BANKACCOUNT ADD                                                
CONSTRAINT C_BP_BANKACCOUNT_KEY                                                 
PRIMARY KEY (                                                                   
C_BP_BANKACCOUNT_ID                                                             
);                                                                              
ALTER TABLE C_BP_CUSTOMER_ACCT ADD                                              
CONSTRAINT C_BP_CUSTOMER_ACCT_KEY                                               
PRIMARY KEY (                                                                   
C_BPARTNER_ID,                                                                  
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_BP_EDI ADD                                                        
CONSTRAINT C_BPARTNER_EDI_KEY                                                   
PRIMARY KEY (                                                                   
C_BP_EDI_ID                                                                     
);                                                                              
ALTER TABLE C_BP_EMPLOYEE_ACCT ADD                                              
CONSTRAINT C_BP_EMPLOYEE_ACCT_KEY                                               
PRIMARY KEY (                                                                   
C_BPARTNER_ID,                                                                  
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_BP_GROUP ADD                                                      
CONSTRAINT C_BP_GROUP_KEY                                                       
PRIMARY KEY (                                                                   
C_BP_GROUP_ID                                                                   
);                                                                              
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT C_BP_GROUP_ACCT_KEY                                                  
PRIMARY KEY (                                                                   
C_ACCTSCHEMA_ID,                                                                
C_BP_GROUP_ID                                                                   
);                                                                              
ALTER TABLE C_BP_RELATION ADD                                                   
CONSTRAINT C_BP_RELATION_KEY                                                    
PRIMARY KEY (                                                                   
C_BP_RELATION_ID                                                                
);                                                                              
ALTER TABLE C_BP_VENDOR_ACCT ADD                                                
CONSTRAINT C_BP_VENDOR_ACCT_KEY                                                 
PRIMARY KEY (                                                                   
C_ACCTSCHEMA_ID,                                                                
C_BPARTNER_ID                                                                   
);                                                                              
ALTER TABLE C_BP_WITHHOLDING ADD                                                
CONSTRAINT C_BO_WITHHOLDING_KEY                                                 
PRIMARY KEY (                                                                   
C_BPARTNER_ID,                                                                  
C_WITHHOLDING_ID                                                                
);                                                                              
ALTER TABLE C_CALENDAR ADD                                                      
CONSTRAINT C_CALENDAR_KEY                                                       
PRIMARY KEY (                                                                   
C_CALENDAR_ID                                                                   
);                                                                              
ALTER TABLE C_CAMPAIGN ADD                                                      
CONSTRAINT C_CAMPAIGN_KEY                                                       
PRIMARY KEY (                                                                   
C_CAMPAIGN_ID                                                                   
);                                                                              
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT C_CASH_KEY                                                           
PRIMARY KEY (                                                                   
C_CASH_ID                                                                       
);                                                                              
ALTER TABLE C_CASHBOOK ADD                                                      
CONSTRAINT C_CASHBOOK_KEY                                                       
PRIMARY KEY (                                                                   
C_CASHBOOK_ID                                                                   
);                                                                              
ALTER TABLE C_CASHBOOK_ACCT ADD                                                 
CONSTRAINT C_CASHBOOK_ACCT_KEY                                                  
PRIMARY KEY (                                                                   
C_CASHBOOK_ID,                                                                  
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_CASHFLOW ADD                                                      
CONSTRAINT C_CASHFLOW_KEY                                                       
PRIMARY KEY (                                                                   
C_CASHFLOW_ID                                                                   
);                                                                              
ALTER TABLE C_CASHLINE ADD                                                      
CONSTRAINT C_CASHLINE_KEY                                                       
PRIMARY KEY (                                                                   
C_CASHLINE_ID                                                                   
);                                                                              
ALTER TABLE C_CHANNEL ADD                                                       
CONSTRAINT C_CHANNEL_ID                                                         
PRIMARY KEY (                                                                   
C_CHANNEL_ID                                                                    
);                                                                              
ALTER TABLE C_CHARGE ADD                                                        
CONSTRAINT C_CHARGE_KEY                                                         
PRIMARY KEY (                                                                   
C_CHARGE_ID                                                                     
);                                                                              
ALTER TABLE C_CHARGE_ACCT ADD                                                   
CONSTRAINT C_CHARHE_ACCT_KEY                                                    
PRIMARY KEY (                                                                   
C_CHARGE_ID,                                                                    
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_CITY ADD                                                          
CONSTRAINT C_CITY_KEY                                                           
PRIMARY KEY (                                                                   
C_CITY_ID                                                                       
);                                                                              
ALTER TABLE C_COMMISSION ADD                                                    
CONSTRAINT C_COMMISSION_KEY                                                     
PRIMARY KEY (                                                                   
C_COMMISSION_ID                                                                 
);                                                                              
ALTER TABLE C_COMMISSIONAMT ADD                                                 
CONSTRAINT C_COMMISSIONAMT_KEY                                                  
PRIMARY KEY (                                                                   
C_COMMISSIONAMT_ID                                                              
);                                                                              
ALTER TABLE C_COMMISSIONDETAIL ADD                                              
CONSTRAINT C_COMMISSIONDETAIL_KEY                                               
PRIMARY KEY (                                                                   
C_COMMISSIONDETAIL_ID                                                           
);                                                                              
ALTER TABLE C_COMMISSIONLINE ADD                                                
CONSTRAINT C_COMMISSIONLINE_KEY                                                 
PRIMARY KEY (                                                                   
C_COMMISSIONLINE_ID                                                             
);                                                                              
ALTER TABLE C_COMMISSIONRUN ADD                                                 
CONSTRAINT C_COMMISSIONRUN_KEY                                                  
PRIMARY KEY (                                                                   
C_COMMISSIONRUN_ID                                                              
);                                                                              
ALTER TABLE C_CONVERSIONTYPE ADD                                                
CONSTRAINT C_CONVERSIONTYPE_KEY                                                 
PRIMARY KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
);                                                                              
ALTER TABLE C_CONVERSION_RATE ADD                                               
CONSTRAINT C_CURRENCYRATE_KEY                                                   
PRIMARY KEY (                                                                   
C_CONVERSION_RATE_ID                                                            
);                                                                              
ALTER TABLE C_COUNTRY ADD                                                       
CONSTRAINT C_COUNTRY_KEY                                                        
PRIMARY KEY (                                                                   
C_COUNTRY_ID                                                                    
);                                                                              
ALTER TABLE C_COUNTRY_TRL ADD                                                   
CONSTRAINT C_COUNTRY_TRL_KEY                                                    
PRIMARY KEY (                                                                   
C_COUNTRY_ID,                                                                   
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_CURRENCY ADD                                                      
CONSTRAINT C_CURRENCY_KEY                                                       
PRIMARY KEY (                                                                   
C_CURRENCY_ID                                                                   
);                                                                              
ALTER TABLE C_CURRENCY_ACCT ADD                                                 
CONSTRAINT C_CURRENCY_ACCT_KEY                                                  
PRIMARY KEY (                                                                   
C_ACCTSCHEMA_ID,                                                                
C_CURRENCY_ID                                                                   
);                                                                              
ALTER TABLE C_CURRENCY_TRL ADD                                                  
CONSTRAINT C_CURRENCY_TRL_KEY                                                   
PRIMARY KEY (                                                                   
C_CURRENCY_ID,                                                                  
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_CYCLE ADD                                                         
CONSTRAINT C_CYCLE_KEY                                                          
PRIMARY KEY (                                                                   
C_CYCLE_ID                                                                      
);                                                                              
ALTER TABLE C_CYCLEPHASE ADD                                                    
CONSTRAINT C_CYCLEPHASE_KEY                                                     
PRIMARY KEY (                                                                   
C_CYCLESTEP_ID,                                                                 
C_PHASE_ID                                                                      
);                                                                              
ALTER TABLE C_CYCLESTEP ADD                                                     
CONSTRAINT C_CYCLESTEP_KEY                                                      
PRIMARY KEY (                                                                   
C_CYCLESTEP_ID                                                                  
);                                                                              
ALTER TABLE C_DOCTYPE ADD                                                       
CONSTRAINT C_DOCTYPE_KEY                                                        
PRIMARY KEY (                                                                   
C_DOCTYPE_ID                                                                    
);                                                                              
ALTER TABLE C_DOCTYPECOUNTER ADD                                                
CONSTRAINT C_DOCTYPECOUNTER_KEY                                                 
PRIMARY KEY (                                                                   
C_DOCTYPECOUNTER_ID                                                             
);                                                                              
ALTER TABLE C_DOCTYPE_TRL ADD                                                   
CONSTRAINT C_DOCTYPE_TRL_KEY                                                    
PRIMARY KEY (                                                                   
C_DOCTYPE_ID,                                                                   
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_DUNNING ADD                                                       
CONSTRAINT C_DUNNING_KEY                                                        
PRIMARY KEY (                                                                   
C_DUNNING_ID                                                                    
);                                                                              
ALTER TABLE C_DUNNINGLEVEL ADD                                                  
CONSTRAINT C_DUNNINGLEVEL_KEY                                                   
PRIMARY KEY (                                                                   
C_DUNNINGLEVEL_ID                                                               
);                                                                              
ALTER TABLE C_DUNNINGLEVEL_TRL ADD                                              
CONSTRAINT C_DUNNINGLEVEL_TRL_KEY                                               
PRIMARY KEY (                                                                   
C_DUNNINGLEVEL_ID,                                                              
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_DUNNINGRUN ADD                                                    
CONSTRAINT C_DUNNINGRUN_KEY                                                     
PRIMARY KEY (                                                                   
C_DUNNINGRUN_ID                                                                 
);                                                                              
ALTER TABLE C_DUNNINGRUNENTRY ADD                                               
CONSTRAINT C_DUNNINGRUNENTRY_KEY                                                
PRIMARY KEY (                                                                   
C_DUNNINGRUNENTRY_ID                                                            
);                                                                              
ALTER TABLE C_DUNNINGRUNLINE ADD                                                
CONSTRAINT C_DUNNINGRUNLINE_KEY                                                 
PRIMARY KEY (                                                                   
C_DUNNINGRUNLINE_ID                                                             
);                                                                              
ALTER TABLE C_ELEMENT ADD                                                       
CONSTRAINT C_ELEMENT_KEY                                                        
PRIMARY KEY (                                                                   
C_ELEMENT_ID                                                                    
);                                                                              
ALTER TABLE C_ELEMENTVALUE ADD                                                  
CONSTRAINT C_ELEMENTVALUE_KEY                                                   
PRIMARY KEY (                                                                   
C_ELEMENTVALUE_ID                                                               
);                                                                              
ALTER TABLE C_ELEMENTVALUE_TRL ADD                                              
CONSTRAINT C_ELEMENTVALUE_TRL_KEY                                               
PRIMARY KEY (                                                                   
C_ELEMENTVALUE_ID,                                                              
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_GREETING ADD                                                      
CONSTRAINT C_GREETING_KEY                                                       
PRIMARY KEY (                                                                   
C_GREETING_ID                                                                   
);                                                                              
ALTER TABLE C_GREETING_TRL ADD                                                  
CONSTRAINT C_GREETING_TRL_KEY                                                   
PRIMARY KEY (                                                                   
C_GREETING_ID,                                                                  
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_INTERORG_ACCT ADD                                                 
CONSTRAINT C_INTERORGACCT_KEY                                                   
PRIMARY KEY (                                                                   
C_ACCTSCHEMA_ID,                                                                
AD_ORG_ID,                                                                      
AD_ORGTO_ID                                                                     
);                                                                              
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT C_INVOICE_ID                                                         
PRIMARY KEY (                                                                   
C_INVOICE_ID                                                                    
);                                                                              
ALTER TABLE C_INVOICEBATCH ADD                                                  
CONSTRAINT C_INVOICEBATCH_KEY                                                   
PRIMARY KEY (                                                                   
C_INVOICEBATCH_ID                                                               
);                                                                              
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT C_INVOICEBATCHLINE_KEY                                               
PRIMARY KEY (                                                                   
C_INVOICEBATCHLINE_ID                                                           
);                                                                              
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT C_INVOICELINE_KEY                                                    
PRIMARY KEY (                                                                   
C_INVOICELINE_ID                                                                
);                                                                              
ALTER TABLE C_INVOICEPAYSCHEDULE ADD                                            
CONSTRAINT C_INVOICEPAYSCHEDULE_KEY                                             
PRIMARY KEY (                                                                   
C_INVOICEPAYSCHEDULE_ID                                                         
);                                                                              
ALTER TABLE C_INVOICESCHEDULE ADD                                               
CONSTRAINT C_INVOICESCHEDULE_KEY                                                
PRIMARY KEY (                                                                   
C_INVOICESCHEDULE_ID                                                            
);                                                                              
ALTER TABLE C_INVOICETAX ADD                                                    
CONSTRAINT C_INVOICETAX_KEY                                                     
PRIMARY KEY (                                                                   
C_TAX_ID,                                                                       
C_INVOICE_ID                                                                    
);                                                                              
ALTER TABLE C_JOB ADD                                                           
CONSTRAINT C_JOB_KEY                                                            
PRIMARY KEY (                                                                   
C_JOB_ID                                                                        
);                                                                              
ALTER TABLE C_JOBASSIGNMENT ADD                                                 
CONSTRAINT C_JOBASSIGNMENT_KEY                                                  
PRIMARY KEY (                                                                   
C_JOBASSIGNMENT_ID                                                              
);                                                                              
ALTER TABLE C_JOBCATEGORY ADD                                                   
CONSTRAINT C_JOBCATEGORY_KEY                                                    
PRIMARY KEY (                                                                   
C_JOBCATEGORY_ID                                                                
);                                                                              
ALTER TABLE C_JOBREMUNERATION ADD                                               
CONSTRAINT C_JOBREMUNERATION_KEY                                                
PRIMARY KEY (                                                                   
C_JOBREMUNERATION_ID                                                            
);                                                                              
ALTER TABLE C_LANDEDCOST ADD                                                    
CONSTRAINT C_LANDEDCOST_KEY                                                     
PRIMARY KEY (                                                                   
C_LANDEDCOST_ID                                                                 
);                                                                              
ALTER TABLE C_LANDEDCOSTALLOCATION ADD                                          
CONSTRAINT C_LANDEDCOSTALLOCATION_KEY                                           
PRIMARY KEY (                                                                   
C_LANDEDCOST_ID,                                                                
M_PRODUCT_ID                                                                    
);                                                                              
ALTER TABLE C_LOCATION ADD                                                      
CONSTRAINT C_LOCATION_KEY                                                       
PRIMARY KEY (                                                                   
C_LOCATION_ID                                                                   
);                                                                              
ALTER TABLE C_NONBUSINESSDAY ADD                                                
CONSTRAINT C_NONBUSINESSDAY_KEY                                                 
PRIMARY KEY (                                                                   
C_NONBUSINESSDAY_ID                                                             
);                                                                              
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT C_ORDER_KEY                                                          
PRIMARY KEY (                                                                   
C_ORDER_ID                                                                      
);                                                                              
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT C_ORDERLINE_KEY                                                      
PRIMARY KEY (                                                                   
C_ORDERLINE_ID                                                                  
);                                                                              
ALTER TABLE C_ORDERTAX ADD                                                      
CONSTRAINT C_ORDERTAX_KEY                                                       
PRIMARY KEY (                                                                   
C_ORDER_ID,                                                                     
C_TAX_ID                                                                        
);                                                                              
ALTER TABLE C_ORGASSIGNMENT ADD                                                 
CONSTRAINT C_ORGASSIGNMENT_KEY                                                  
PRIMARY KEY (                                                                   
C_ORGASSIGNMENT_ID                                                              
);                                                                              
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT C_PAYMENT_KEY                                                        
PRIMARY KEY (                                                                   
C_PAYMENT_ID                                                                    
);                                                                              
ALTER TABLE C_PAYMENTBATCH ADD                                                  
CONSTRAINT C_PAYMENTBATCH_KEY                                                   
PRIMARY KEY (                                                                   
C_PAYMENTBATCH_ID                                                               
);                                                                              
ALTER TABLE C_PAYMENTPROCESSOR ADD                                              
CONSTRAINT C_PAYMENTPROCESSOR_ID                                                
PRIMARY KEY (                                                                   
C_PAYMENTPROCESSOR_ID                                                           
);                                                                              
ALTER TABLE C_PAYMENTTERM ADD                                                   
CONSTRAINT C_PAYMENTTERM_KEY                                                    
PRIMARY KEY (                                                                   
C_PAYMENTTERM_ID                                                                
);                                                                              
ALTER TABLE C_PAYMENTTERM_TRL ADD                                               
CONSTRAINT C_PAYMENTTERM_TRL_KEY                                                
PRIMARY KEY (                                                                   
C_PAYMENTTERM_ID,                                                               
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_PAYSCHEDULE ADD                                                   
CONSTRAINT C_PAYSCHEDULE_KEY                                                    
PRIMARY KEY (                                                                   
C_PAYSCHEDULE_ID                                                                
);                                                                              
ALTER TABLE C_PAYSELECTION ADD                                                  
CONSTRAINT C_PAYSELECTION_KEY                                                   
PRIMARY KEY (                                                                   
C_PAYSELECTION_ID                                                               
);                                                                              
ALTER TABLE C_PAYSELECTIONCHECK ADD                                             
CONSTRAINT C_PAYSELECTIONCHECK_KEY                                              
PRIMARY KEY (                                                                   
C_PAYSELECTIONCHECK_ID                                                          
);                                                                              
ALTER TABLE C_PAYSELECTIONLINE ADD                                              
CONSTRAINT C_PAYSELECTIONLINE_KEY                                               
PRIMARY KEY (                                                                   
C_PAYSELECTIONLINE_ID                                                           
);                                                                              
ALTER TABLE C_PERIOD ADD                                                        
CONSTRAINT C_PERIOD_KEY                                                         
PRIMARY KEY (                                                                   
C_PERIOD_ID                                                                     
);                                                                              
ALTER TABLE C_PERIODCONTROL ADD                                                 
CONSTRAINT C_PERIODCONTROL_KEY                                                  
PRIMARY KEY (                                                                   
C_PERIODCONTROL_ID                                                              
);                                                                              
ALTER TABLE C_PHASE ADD                                                         
CONSTRAINT C_PHASE_KEY                                                          
PRIMARY KEY (                                                                   
C_PHASE_ID                                                                      
);                                                                              
ALTER TABLE C_POS ADD                                                           
CONSTRAINT C_POS_KEY                                                            
PRIMARY KEY (                                                                   
C_POS_ID                                                                        
);                                                                              
ALTER TABLE C_POSKEY ADD                                                        
CONSTRAINT C_POSKEY_KEY                                                         
PRIMARY KEY (                                                                   
C_POSKEY_ID                                                                     
);                                                                              
ALTER TABLE C_POSKEYLAYOUT ADD                                                  
CONSTRAINT C_POSKEYLAYOUT_KEY                                                   
PRIMARY KEY (                                                                   
C_POSKEYLAYOUT_ID                                                               
);                                                                              
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT C_PROJECT_KEY                                                        
PRIMARY KEY (                                                                   
C_PROJECT_ID                                                                    
);                                                                              
ALTER TABLE C_PROJECTISSUE ADD                                                  
CONSTRAINT C_PROJECTISSUE_KEY                                                   
PRIMARY KEY (                                                                   
C_PROJECTISSUE_ID                                                               
);                                                                              
ALTER TABLE C_PROJECTISSUEMA ADD                                                
CONSTRAINT C_PROJECTISSUEMA_KEY                                                 
PRIMARY KEY (                                                                   
C_PROJECTISSUE_ID,                                                              
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
ALTER TABLE C_PROJECTLINE ADD                                                   
CONSTRAINT C_PROJECTLINE_KEY                                                    
PRIMARY KEY (                                                                   
C_PROJECTLINE_ID                                                                
);                                                                              
ALTER TABLE C_PROJECTPHASE ADD                                                  
CONSTRAINT C_PROJECTPHASE_KEY                                                   
PRIMARY KEY (                                                                   
C_PROJECTPHASE_ID                                                               
);                                                                              
ALTER TABLE C_PROJECTTASK ADD                                                   
CONSTRAINT C_PROJECTTASK_KEY                                                    
PRIMARY KEY (                                                                   
C_PROJECTTASK_ID                                                                
);                                                                              
ALTER TABLE C_PROJECTTYPE ADD                                                   
CONSTRAINT C_PROJECTTYPE_KEY                                                    
PRIMARY KEY (                                                                   
C_PROJECTTYPE_ID                                                                
);                                                                              
ALTER TABLE C_PROJECT_ACCT ADD                                                  
CONSTRAINT C_PROJECT_ACCT_KEY                                                   
PRIMARY KEY (                                                                   
C_PROJECT_ID,                                                                   
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_RECURRING ADD                                                     
CONSTRAINT C_RECURRING_KEY                                                      
PRIMARY KEY (                                                                   
C_RECURRING_ID                                                                  
);                                                                              
ALTER TABLE C_RECURRING_RUN ADD                                                 
CONSTRAINT C_RECURRING_RUN_KEY                                                  
PRIMARY KEY (                                                                   
C_RECURRING_RUN_ID                                                              
);                                                                              
ALTER TABLE C_REGION ADD                                                        
CONSTRAINT C_REGION_KEY                                                         
PRIMARY KEY (                                                                   
C_REGION_ID                                                                     
);                                                                              
ALTER TABLE C_REMUNERATION ADD                                                  
CONSTRAINT C_REMUNERATION_KEY                                                   
PRIMARY KEY (                                                                   
C_REMUNERATION_ID                                                               
);                                                                              
ALTER TABLE C_REVENUERECOGNITION ADD                                            
CONSTRAINT C_REVENUERECOGNITION_ID                                              
PRIMARY KEY (                                                                   
C_REVENUERECOGNITION_ID                                                         
);                                                                              
ALTER TABLE C_REVENUERECOGNITION_PLAN ADD                                       
CONSTRAINT C_REVENUERECOGNITIONPLAN_KEY                                         
PRIMARY KEY (                                                                   
C_REVENUERECOGNITION_PLAN_ID                                                    
);                                                                              
ALTER TABLE C_REVENUERECOGNITION_RUN ADD                                        
CONSTRAINT C_REVENUERECOGNITIONRUN_KEY                                          
PRIMARY KEY (                                                                   
C_REVENUERECOGNITION_RUN_ID                                                     
);                                                                              
ALTER TABLE C_RFQ ADD                                                           
CONSTRAINT C_RFQ_KEY                                                            
PRIMARY KEY (                                                                   
C_RFQ_ID                                                                        
);                                                                              
ALTER TABLE C_RFQLINE ADD                                                       
CONSTRAINT C_RFQLINE_KEY                                                        
PRIMARY KEY (                                                                   
C_RFQLINE_ID                                                                    
);                                                                              
ALTER TABLE C_RFQLINEQTY ADD                                                    
CONSTRAINT C_RFQLINEQTY_KEY                                                     
PRIMARY KEY (                                                                   
C_RFQLINEQTY_ID                                                                 
);                                                                              
ALTER TABLE C_RFQRESPONSE ADD                                                   
CONSTRAINT C_RFQRESPONSE_KEY                                                    
PRIMARY KEY (                                                                   
C_RFQRESPONSE_ID                                                                
);                                                                              
ALTER TABLE C_RFQRESPONSELINE ADD                                               
CONSTRAINT C_RFQRESPONSELINE_KEY                                                
PRIMARY KEY (                                                                   
C_RFQRESPONSELINE_ID                                                            
);                                                                              
ALTER TABLE C_RFQRESPONSELINEQTY ADD                                            
CONSTRAINT C_RFQRESPONSELINEQTY_KEY                                             
PRIMARY KEY (                                                                   
C_RFQRESPONSELINEQTY_ID                                                         
);                                                                              
ALTER TABLE C_RFQ_TOPIC ADD                                                     
CONSTRAINT C_RFQ_TOPIC_KEY                                                      
PRIMARY KEY (                                                                   
C_RFQ_TOPIC_ID                                                                  
);                                                                              
ALTER TABLE C_RFQ_TOPICSUBSCRIBER ADD                                           
CONSTRAINT C_RFQ_TOPICSUBSCRIBER_KEY                                            
PRIMARY KEY (                                                                   
C_RFQ_TOPICSUBSCRIBER_ID                                                        
);                                                                              
ALTER TABLE C_RFQ_TOPICSUBSCRIBERONLY ADD                                       
CONSTRAINT C_RFQ_TOPICSUBSCRIBERONLY_KEY                                        
PRIMARY KEY (                                                                   
C_RFQ_TOPICSUBSCRIBERONLY_ID                                                    
);                                                                              
ALTER TABLE C_SALESREGION ADD                                                   
CONSTRAINT C_SALESREGION_KEY                                                    
PRIMARY KEY (                                                                   
C_SALESREGION_ID                                                                
);                                                                              
ALTER TABLE C_SERVICELEVEL ADD                                                  
CONSTRAINT C_SERVICELEVEL_KEY                                                   
PRIMARY KEY (                                                                   
C_SERVICELEVEL_ID                                                               
);                                                                              
ALTER TABLE C_SERVICELEVELLINE ADD                                              
CONSTRAINT C_SERVICELEVELLINE_KEY                                               
PRIMARY KEY (                                                                   
C_SERVICELEVELLINE_ID                                                           
);                                                                              
ALTER TABLE C_SUBSCRIPTION ADD                                                  
CONSTRAINT C_SUBSCRIPTION_KEY                                                   
PRIMARY KEY (                                                                   
C_SUBSCRIPTION_ID                                                               
);                                                                              
ALTER TABLE C_SUBSCRIPTIONTYPE ADD                                              
CONSTRAINT C_SUBSCRIPTIONTYPE_KEY                                               
PRIMARY KEY (                                                                   
C_SUBSCRIPTIONTYPE_ID                                                           
);                                                                              
ALTER TABLE C_SUBSCRIPTION_DELIVERY ADD                                         
CONSTRAINT C_SUBSCRIPTION_DELIVERY_KEY                                          
PRIMARY KEY (                                                                   
C_SUBSCRIPTION_DELIVERY_ID                                                      
);                                                                              
ALTER TABLE C_TASK ADD                                                          
CONSTRAINT C_TASK_KEY                                                           
PRIMARY KEY (                                                                   
C_TASK_ID                                                                       
);                                                                              
ALTER TABLE C_TAX ADD                                                           
CONSTRAINT C_TAX_ID                                                             
PRIMARY KEY (                                                                   
C_TAX_ID                                                                        
);                                                                              
ALTER TABLE C_TAXCATEGORY ADD                                                   
CONSTRAINT C_TAXCATEGORY_KEY                                                    
PRIMARY KEY (                                                                   
C_TAXCATEGORY_ID                                                                
);                                                                              
ALTER TABLE C_TAXCATEGORY_TRL ADD                                               
CONSTRAINT C_TAXCATEGORY_TRL_KEY                                                
PRIMARY KEY (                                                                   
C_TAXCATEGORY_ID,                                                               
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_TAXPOSTAL ADD                                                     
CONSTRAINT C_TAXPOSTAL_KEY                                                      
PRIMARY KEY (                                                                   
C_TAXPOSTAL_ID                                                                  
);                                                                              
ALTER TABLE C_TAX_ACCT ADD                                                      
CONSTRAINT C_TAX_ACCT_KEY                                                       
PRIMARY KEY (                                                                   
C_TAX_ID,                                                                       
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_TAX_TRL ADD                                                       
CONSTRAINT C_TAX_TRL_KEY                                                        
PRIMARY KEY (                                                                   
C_TAX_ID,                                                                       
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_UOM ADD                                                           
CONSTRAINT C_UOM_KEY                                                            
PRIMARY KEY (                                                                   
C_UOM_ID                                                                        
);                                                                              
ALTER TABLE C_UOM_CONVERSION ADD                                                
CONSTRAINT C_UOM_CONVERSION_KEY                                                 
PRIMARY KEY (                                                                   
C_UOM_CONVERSION_ID                                                             
);                                                                              
ALTER TABLE C_UOM_TRL ADD                                                       
CONSTRAINT C_UOM_TRL_KEY                                                        
PRIMARY KEY (                                                                   
C_UOM_ID,                                                                       
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE C_USERREMUNERATION ADD                                              
CONSTRAINT C_USERREMUNERATION_KEY                                               
PRIMARY KEY (                                                                   
C_USERREMUNERATION_ID                                                           
);                                                                              
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT C_VALIDCOMBINATION_KEY                                               
PRIMARY KEY (                                                                   
C_VALIDCOMBINATION_ID                                                           
);                                                                              
ALTER TABLE C_WITHHOLDING ADD                                                   
CONSTRAINT C_WITHHOLDING_KEY                                                    
PRIMARY KEY (                                                                   
C_WITHHOLDING_ID                                                                
);                                                                              
ALTER TABLE C_WITHHOLDING_ACCT ADD                                              
CONSTRAINT C_WITHHOLDING_ACCT_KEY                                               
PRIMARY KEY (                                                                   
C_WITHHOLDING_ID,                                                               
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE C_YEAR ADD                                                          
CONSTRAINT C_YEAR_KEY                                                           
PRIMARY KEY (                                                                   
C_YEAR_ID                                                                       
);                                                                              
ALTER TABLE DBA_ERRORLOG ADD                                                    
CONSTRAINT DBA_ERRORLOG_KEY                                                     
PRIMARY KEY (                                                                   
DBA_ERRORLOG_ID                                                                 
);                                                                              
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT FACT_ACCT_KEY                                                        
PRIMARY KEY (                                                                   
FACT_ACCT_ID                                                                    
);                                                                              
ALTER TABLE GL_BUDGET ADD                                                       
CONSTRAINT GL_BUDGET_KEY                                                        
PRIMARY KEY (                                                                   
GL_BUDGET_ID                                                                    
);                                                                              
ALTER TABLE GL_CATEGORY ADD                                                     
CONSTRAINT GL_CATEGORY_KEY                                                      
PRIMARY KEY (                                                                   
GL_CATEGORY_ID                                                                  
);                                                                              
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT GL_DISTRIBUTION_KEY                                                  
PRIMARY KEY (                                                                   
GL_DISTRIBUTION_ID                                                              
);                                                                              
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT GL_DUSTRIBUTIONLINE_KEY                                              
PRIMARY KEY (                                                                   
GL_DISTRIBUTIONLINE_ID                                                          
);                                                                              
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT GL_JOURNAL_KEY                                                       
PRIMARY KEY (                                                                   
GL_JOURNAL_ID                                                                   
);                                                                              
ALTER TABLE GL_JOURNALBATCH ADD                                                 
CONSTRAINT GL_JOURNALBATCH_KEY                                                  
PRIMARY KEY (                                                                   
GL_JOURNALBATCH_ID                                                              
);                                                                              
ALTER TABLE GL_JOURNALLINE ADD                                                  
CONSTRAINT GL_JOURNALENTRY_KEY                                                  
PRIMARY KEY (                                                                   
GL_JOURNALLINE_ID                                                               
);                                                                              
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT I_BANKSTATEMENT_KEY                                                  
PRIMARY KEY (                                                                   
I_BANKSTATEMENT_ID                                                              
);                                                                              
ALTER TABLE I_BPARTNER ADD                                                      
CONSTRAINT I_BPARTNER_KEY                                                       
PRIMARY KEY (                                                                   
I_BPARTNER_ID                                                                   
);                                                                              
ALTER TABLE I_CONVERSION_RATE ADD                                               
CONSTRAINT I_CONVERSION_RATE_KEY                                                
PRIMARY KEY (                                                                   
I_CONVERSION_RATE_ID                                                            
);                                                                              
ALTER TABLE I_ELEMENTVALUE ADD                                                  
CONSTRAINT I_ELEMENTVALUE_KEY                                                   
PRIMARY KEY (                                                                   
I_ELEMENTVALUE_ID                                                               
);                                                                              
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT I_GLJOURNAL_KEY                                                      
PRIMARY KEY (                                                                   
I_GLJOURNAL_ID                                                                  
);                                                                              
ALTER TABLE I_INOUTLINECONFIRM ADD                                              
CONSTRAINT I_INOUTLINECONFIRM_KEY                                               
PRIMARY KEY (                                                                   
I_INOUTLINECONFIRM_ID                                                           
);                                                                              
ALTER TABLE I_INVENTORY ADD                                                     
CONSTRAINT I_INVENTORY_KEY                                                      
PRIMARY KEY (                                                                   
I_INVENTORY_ID                                                                  
);                                                                              
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT I_INVOICE_KEY                                                        
PRIMARY KEY (                                                                   
I_INVOICE_ID                                                                    
);                                                                              
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT I_ORDER_KEY                                                          
PRIMARY KEY (                                                                   
I_ORDER_ID                                                                      
);                                                                              
ALTER TABLE I_PAYMENT ADD                                                       
CONSTRAINT I_PAYMENT_KEY                                                        
PRIMARY KEY (                                                                   
I_PAYMENT_ID                                                                    
);                                                                              
ALTER TABLE I_PRODUCT ADD                                                       
CONSTRAINT I_PRODUCT_KEY                                                        
PRIMARY KEY (                                                                   
I_PRODUCT_ID                                                                    
);                                                                              
ALTER TABLE I_REPORTLINE ADD                                                    
CONSTRAINT I_REPORTLINE_KEY                                                     
PRIMARY KEY (                                                                   
I_REPORTLINE_ID                                                                 
);                                                                              
ALTER TABLE I_ROLE_ACCESS ADD                                                   
CONSTRAINT I_ROLE_ACCESS_KEY                                                    
PRIMARY KEY (                                                                   
I_ROLE_ACCESS_ID                                                                
);                                                                              
ALTER TABLE K_CATEGORY ADD                                                      
CONSTRAINT K_CATEGORY_KEY                                                       
PRIMARY KEY (                                                                   
K_CATEGORY_ID                                                                   
);                                                                              
ALTER TABLE K_CATEGORYVALUE ADD                                                 
CONSTRAINT K_CATEGORYVALUE_KEY                                                  
PRIMARY KEY (                                                                   
K_CATEGORYVALUE_ID                                                              
);                                                                              
ALTER TABLE K_COMMENT ADD                                                       
CONSTRAINT K_COMMENT_KEY                                                        
PRIMARY KEY (                                                                   
K_COMMENT_ID                                                                    
);                                                                              
ALTER TABLE K_ENTRY ADD                                                         
CONSTRAINT K_ENTRY_KEY                                                          
PRIMARY KEY (                                                                   
K_ENTRY_ID                                                                      
);                                                                              
ALTER TABLE K_ENTRYCATEGORY ADD                                                 
CONSTRAINT K_ENTRYCATEGORY_KEY                                                  
PRIMARY KEY (                                                                   
K_CATEGORY_ID,                                                                  
K_ENTRY_ID                                                                      
);                                                                              
ALTER TABLE K_ENTRYRELATED ADD                                                  
CONSTRAINT K_ENTRYRELATED_KEY                                                   
PRIMARY KEY (                                                                   
K_ENTRY_ID,                                                                     
K_ENTRYRELATED_ID                                                               
);                                                                              
ALTER TABLE K_SOURCE ADD                                                        
CONSTRAINT K_SOURCE_KEY                                                         
PRIMARY KEY (                                                                   
K_SOURCE_ID                                                                     
);                                                                              
ALTER TABLE K_SYNONYM ADD                                                       
CONSTRAINT K_SYNONYM_KEY                                                        
PRIMARY KEY (                                                                   
K_SYNONYM_ID                                                                    
);                                                                              
ALTER TABLE K_TOPIC ADD                                                         
CONSTRAINT K_TOPIC_KEY                                                          
PRIMARY KEY (                                                                   
K_TOPIC_ID                                                                      
);                                                                              
ALTER TABLE K_TYPE ADD                                                          
CONSTRAINT K_TYPE_KEY                                                           
PRIMARY KEY (                                                                   
K_TYPE_ID                                                                       
);                                                                              
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT MPC_COST_COLLECTOR_KEY                                               
PRIMARY KEY (                                                                   
MPC_COST_COLLECTOR_ID                                                           
);                                                                              
ALTER TABLE MPC_COST_ELEMENT ADD                                                
CONSTRAINT MPC_COST_ELEMENT_KEY                                                 
PRIMARY KEY (                                                                   
MPC_COST_ELEMENT_ID                                                             
);                                                                              
ALTER TABLE MPC_COST_ELEMENT_ACCT ADD                                           
CONSTRAINT MPC_COST_ELEMENT_ACCT_KEY                                            
PRIMARY KEY (                                                                   
MPC_COST_ELEMENT_ID,                                                            
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE MPC_COST_GROUP ADD                                                  
CONSTRAINT MPC_COST_GROUP_KEY                                                   
PRIMARY KEY (                                                                   
MPC_COST_GROUP_ID                                                               
);                                                                              
ALTER TABLE MPC_MRP ADD                                                         
CONSTRAINT MPC_MRP_KEY                                                          
PRIMARY KEY (                                                                   
MPC_MRP_ID                                                                      
);                                                                              
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT MPC_ORDER_KEY                                                        
PRIMARY KEY (                                                                   
MPC_ORDER_ID                                                                    
);                                                                              
ALTER TABLE MPC_ORDER_BOM ADD                                                   
CONSTRAINT MPC_ORDER_BOM_KEY                                                    
PRIMARY KEY (                                                                   
MPC_ORDER_BOM_ID                                                                
);                                                                              
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT MPC_ORDER_BOMLINE_KEY                                                
PRIMARY KEY (                                                                   
MPC_ORDER_BOMLINE_ID                                                            
);                                                                              
ALTER TABLE MPC_ORDER_BOMLINEMA ADD                                             
CONSTRAINT MPC_ORDER_BOMLINEMA_KEY                                              
PRIMARY KEY (                                                                   
MPC_ORDER_BOMLINE_ID,                                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
ALTER TABLE MPC_ORDER_COST ADD                                                  
CONSTRAINT MPC_ORDER_COST_KEY                                                   
PRIMARY KEY (                                                                   
MPC_ORDER_COST_ID,                                                              
M_PRODUCT_ID,                                                                   
MPC_COST_ELEMENT_ID                                                             
);                                                                              
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT MPC_ORDER_NODE_KEY                                                   
PRIMARY KEY (                                                                   
MPC_ORDER_NODE_ID,                                                              
MPC_ORDER_ID                                                                    
);                                                                              
ALTER TABLE MPC_ORDER_NODENEXT ADD                                              
CONSTRAINT MPC_ORDER_NODENEXT_KEY                                               
PRIMARY KEY (                                                                   
MPC_ORDER_NODE_ID,                                                              
MPC_ORDER_NEXT_ID                                                               
);                                                                              
ALTER TABLE MPC_ORDER_NODE_ASSET ADD                                            
CONSTRAINT MPC_ORDER_NODE_ASSET_KEY                                             
PRIMARY KEY (                                                                   
MPC_ORDER_NODE_ASSET_ID                                                         
);                                                                              
ALTER TABLE MPC_ORDER_NODE_PRODUCT ADD                                          
CONSTRAINT MPC_ORDER_NODE_PRODUCT_KEY                                           
PRIMARY KEY (                                                                   
MPC_ORDER_NODE_PRODUCT_ID                                                       
);                                                                              
ALTER TABLE MPC_ORDER_WORKFLOW ADD                                              
CONSTRAINT MPC_ORDER_WORKFLOW_KEY                                               
PRIMARY KEY (                                                                   
MPC_ORDER_WORKFLOW_ID,                                                          
MPC_ORDER_ID                                                                    
);                                                                              
ALTER TABLE MPC_PRODUCT_BOM ADD                                                 
CONSTRAINT MPC_PRODUCT_BOM_KEY                                                  
PRIMARY KEY (                                                                   
MPC_PRODUCT_BOM_ID                                                              
);                                                                              
ALTER TABLE MPC_PRODUCT_BOMLINE ADD                                             
CONSTRAINT MPC_PRODUCT_BOMLINE_KEY                                              
PRIMARY KEY (                                                                   
MPC_PRODUCT_BOMLINE_ID                                                          
);                                                                              
ALTER TABLE MPC_PRODUCT_COSTING ADD                                             
CONSTRAINT MP_PRODUCT_COSTING_KEY                                               
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
C_ACCTSCHEMA_ID,                                                                
MPC_COST_GROUP_ID,                                                              
MPC_COST_ELEMENT_ID,                                                            
S_RESOURCE_ID,                                                                  
M_WAREHOUSE_ID                                                                  
);                                                                              
ALTER TABLE MPC_PRODUCT_PLANNING ADD                                            
CONSTRAINT MPC_PRODUCT_PLANNING_KEY                                             
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
S_RESOURCE_ID,                                                                  
M_WAREHOUSE_ID                                                                  
);                                                                              
ALTER TABLE MPC_PROFILEBOM ADD                                                  
CONSTRAINT MPC_PROFILEBOM_KEY                                                   
PRIMARY KEY (                                                                   
MPC_PROFILEBOM_ID                                                               
);                                                                              
ALTER TABLE MPC_PROFILEBOMCOST ADD                                              
CONSTRAINT MPC_PROFILEBOMCOST_KEY                                               
PRIMARY KEY (                                                                   
MPC_PROFILEBOMCOST_ID                                                           
);                                                                              
ALTER TABLE MPC_PROFILEBOMLINE ADD                                              
CONSTRAINT MPC_PROFILEBOMLINE_KEY                                               
PRIMARY KEY (                                                                   
MPC_PROFILEBOMLINE_ID                                                           
);                                                                              
ALTER TABLE MPC_PROFILEBOM_PRODUCT ADD                                          
CONSTRAINT MPC_PROFILEBOM_PRODUCT_KEY                                           
PRIMARY KEY (                                                                   
MPC_PROFILEBOM_PRODUCT_ID                                                       
);                                                                              
ALTER TABLE MPC_PROFILEBOM_REAL ADD                                             
CONSTRAINT MPC_PROFILEBOM_REAL_KEY                                              
PRIMARY KEY (                                                                   
MPC_PROFILEBOM_REAL_ID                                                          
);                                                                              
ALTER TABLE MPC_PROFILEBOM_SELECTED ADD                                         
CONSTRAINT MPC_PROFILEBOM_SELECTED_KEY                                          
PRIMARY KEY (                                                                   
MPC_PROFILEBOM_SELECTED_ID                                                      
);                                                                              
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT MPC_SCHEDULE_KEY                                                     
PRIMARY KEY (                                                                   
MPC_SCHEDULE_ID                                                                 
);                                                                              
ALTER TABLE MPC_WF_NODE_ASSET ADD                                               
CONSTRAINT MPC_WF_NODE_ASSET_KEY                                                
PRIMARY KEY (                                                                   
MPC_WF_NODE_ASSET_ID                                                            
);                                                                              
ALTER TABLE MPC_WF_NODE_PRODUCT ADD                                             
CONSTRAINT MPC_WF_NODE_PRODUCT_KEY                                              
PRIMARY KEY (                                                                   
MPC_WF_NODE_PRODUCT_ID                                                          
);                                                                              
ALTER TABLE M_ATTRIBUTE ADD                                                     
CONSTRAINT M_ATTRIBUTE_KEY                                                      
PRIMARY KEY (                                                                   
M_ATTRIBUTE_ID                                                                  
);                                                                              
ALTER TABLE M_ATTRIBUTEINSTANCE ADD                                             
CONSTRAINT M_ATTRIBUTEINSTANCE_KEY                                              
PRIMARY KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID,                                                      
M_ATTRIBUTE_ID                                                                  
);                                                                              
ALTER TABLE M_ATTRIBUTESEARCH ADD                                               
CONSTRAINT M_ATTRIBUTESEARCH_KEY                                                
PRIMARY KEY (                                                                   
M_ATTRIBUTESEARCH_ID                                                            
);                                                                              
ALTER TABLE M_ATTRIBUTESET ADD                                                  
CONSTRAINT M_ATTRIBUTESET_KEY                                                   
PRIMARY KEY (                                                                   
M_ATTRIBUTESET_ID                                                               
);                                                                              
ALTER TABLE M_ATTRIBUTESETINSTANCE ADD                                          
CONSTRAINT M_ATTRIBUTESETINSTANCE_KEY                                           
PRIMARY KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
ALTER TABLE M_ATTRIBUTEUSE ADD                                                  
CONSTRAINT M_ATTRIBUTEUSE_KEY                                                   
PRIMARY KEY (                                                                   
M_ATTRIBUTE_ID,                                                                 
M_ATTRIBUTESET_ID                                                               
);                                                                              
ALTER TABLE M_ATTRIBUTEVALUE ADD                                                
CONSTRAINT M_ATTRIBUTEVALUE_KEY                                                 
PRIMARY KEY (                                                                   
M_ATTRIBUTEVALUE_ID                                                             
);                                                                              
ALTER TABLE M_BOM ADD                                                           
CONSTRAINT M_BOM_KEY                                                            
PRIMARY KEY (                                                                   
M_BOM_ID                                                                        
);                                                                              
ALTER TABLE M_BOMALTERNATIVE ADD                                                
CONSTRAINT M_BOMALTERNATIVE_KEY                                                 
PRIMARY KEY (                                                                   
M_BOMALTERNATIVE_ID                                                             
);                                                                              
ALTER TABLE M_BOMPRODUCT ADD                                                    
CONSTRAINT M_BOMPRODUCT_KEY                                                     
PRIMARY KEY (                                                                   
M_BOMPRODUCT_ID                                                                 
);                                                                              
ALTER TABLE M_CHANGENOTICE ADD                                                  
CONSTRAINT M_CHANCENOTICE_KEY                                                   
PRIMARY KEY (                                                                   
M_CHANGENOTICE_ID                                                               
);                                                                              
ALTER TABLE M_CHANGEREQUEST ADD                                                 
CONSTRAINT M_CHANGEREQUEST_KEY                                                  
PRIMARY KEY (                                                                   
M_CHANGEREQUEST_ID                                                              
);                                                                              
ALTER TABLE M_COST ADD                                                          
CONSTRAINT M_COST_KEY                                                           
PRIMARY KEY (                                                                   
AD_CLIENT_ID,                                                                   
AD_ORG_ID,                                                                      
M_PRODUCT_ID,                                                                   
M_COSTTYPE_ID,                                                                  
C_ACCTSCHEMA_ID,                                                                
M_COSTELEMENT_ID                                                                
);                                                                              
ALTER TABLE M_COSTELEMENT ADD                                                   
CONSTRAINT M_COSTELEMENT_KEY                                                    
PRIMARY KEY (                                                                   
M_COSTELEMENT_ID                                                                
);                                                                              
ALTER TABLE M_COSTTYPE ADD                                                      
CONSTRAINT M_COSTTYPE_KEY                                                       
PRIMARY KEY (                                                                   
M_COSTTYPE_ID                                                                   
);                                                                              
ALTER TABLE M_DEMAND ADD                                                        
CONSTRAINT M_DEMAND_KEY                                                         
PRIMARY KEY (                                                                   
M_DEMAND_ID                                                                     
);                                                                              
ALTER TABLE M_DEMANDDETAIL ADD                                                  
CONSTRAINT M_DEMANDDETAIL_KEY                                                   
PRIMARY KEY (                                                                   
M_DEMANDDETAIL_ID                                                               
);                                                                              
ALTER TABLE M_DEMANDLINE ADD                                                    
CONSTRAINT M_DEMANDLINE_KEY                                                     
PRIMARY KEY (                                                                   
M_DEMANDLINE_ID                                                                 
);                                                                              
ALTER TABLE M_DISCOUNTSCHEMA ADD                                                
CONSTRAINT M_DISCOUNT_KEY                                                       
PRIMARY KEY (                                                                   
M_DISCOUNTSCHEMA_ID                                                             
);                                                                              
ALTER TABLE M_DISCOUNTSCHEMABREAK ADD                                           
CONSTRAINT M_DISCOUNTSCHEMABREAK_KEY                                            
PRIMARY KEY (                                                                   
M_DISCOUNTSCHEMABREAK_ID                                                        
);                                                                              
ALTER TABLE M_DISCOUNTSCHEMALINE ADD                                            
CONSTRAINT M_DISCOUNTSCHEMALINE_KEY                                             
PRIMARY KEY (                                                                   
M_DISCOUNTSCHEMALINE_ID                                                         
);                                                                              
ALTER TABLE M_DISTRIBUTIONLIST ADD                                              
CONSTRAINT M_DISTRIBUTIONLIST_KEY                                               
PRIMARY KEY (                                                                   
M_DISTRIBUTIONLIST_ID                                                           
);                                                                              
ALTER TABLE M_DISTRIBUTIONLISTLINE ADD                                          
CONSTRAINT M_DISTRIBUTIONLISTLINE_KEY                                           
PRIMARY KEY (                                                                   
M_DISTRIBUTIONLISTLINE_ID                                                       
);                                                                              
ALTER TABLE M_DISTRIBUTIONRUN ADD                                               
CONSTRAINT M_DISTRIBUTIONRUN_KEY                                                
PRIMARY KEY (                                                                   
M_DISTRIBUTIONRUN_ID                                                            
);                                                                              
ALTER TABLE M_DISTRIBUTIONRUNLINE ADD                                           
CONSTRAINT M_DISTRIBUTIONRUNLINE_KEY                                            
PRIMARY KEY (                                                                   
M_DISTRIBUTIONRUNLINE_ID                                                        
);                                                                              
ALTER TABLE M_EDI ADD                                                           
CONSTRAINT M_EDI_KEY                                                            
PRIMARY KEY (                                                                   
M_EDI_ID                                                                        
);                                                                              
ALTER TABLE M_EDI_INFO ADD                                                      
CONSTRAINT M_EDI_INFO_KEY                                                       
PRIMARY KEY (                                                                   
M_EDI_INFO_ID                                                                   
);                                                                              
ALTER TABLE M_FORECAST ADD                                                      
CONSTRAINT M_FORECAST_KEY                                                       
PRIMARY KEY (                                                                   
M_FORECAST_ID                                                                   
);                                                                              
ALTER TABLE M_FORECASTLINE ADD                                                  
CONSTRAINT M_FORECASTLINE_KEY                                                   
PRIMARY KEY (                                                                   
M_FORECASTLINE_ID                                                               
);                                                                              
ALTER TABLE M_FREIGHT ADD                                                       
CONSTRAINT M_FREIGHT_KEY                                                        
PRIMARY KEY (                                                                   
M_FREIGHT_ID                                                                    
);                                                                              
ALTER TABLE M_FREIGHTCATEGORY ADD                                               
CONSTRAINT M_FREIGHTCATEGORY_KEY                                                
PRIMARY KEY (                                                                   
M_FREIGHTCATEGORY_ID                                                            
);                                                                              
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT M_INOUT_KEY                                                          
PRIMARY KEY (                                                                   
M_INOUT_ID                                                                      
);                                                                              
ALTER TABLE M_INOUTCONFIRM ADD                                                  
CONSTRAINT M_INOUTCONFIRM_KEY                                                   
PRIMARY KEY (                                                                   
M_INOUTCONFIRM_ID                                                               
);                                                                              
ALTER TABLE M_INOUTLINE ADD                                                     
CONSTRAINT M_INOUTLINE_KEY                                                      
PRIMARY KEY (                                                                   
M_INOUTLINE_ID                                                                  
);                                                                              
ALTER TABLE M_INOUTLINECONFIRM ADD                                              
CONSTRAINT M_INOUTLINECONFIRM_KEY                                               
PRIMARY KEY (                                                                   
M_INOUTLINECONFIRM_ID                                                           
);                                                                              
ALTER TABLE M_INOUTLINEMA ADD                                                   
CONSTRAINT M_INOUTLINEMA_KEY                                                    
PRIMARY KEY (                                                                   
M_INOUTLINE_ID,                                                                 
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT M_INVENTORY_KEY                                                      
PRIMARY KEY (                                                                   
M_INVENTORY_ID                                                                  
);                                                                              
ALTER TABLE M_INVENTORYLINE ADD                                                 
CONSTRAINT M_INVENTORYLINE_KEY                                                  
PRIMARY KEY (                                                                   
M_INVENTORYLINE_ID                                                              
);                                                                              
ALTER TABLE M_INVENTORYLINEMA ADD                                               
CONSTRAINT M_INVENTORYLINEMA_KEY                                                
PRIMARY KEY (                                                                   
M_INVENTORYLINE_ID,                                                             
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
ALTER TABLE M_LOCATOR ADD                                                       
CONSTRAINT M_LOCATOR_KEY                                                        
PRIMARY KEY (                                                                   
M_LOCATOR_ID                                                                    
);                                                                              
ALTER TABLE M_LOT ADD                                                           
CONSTRAINT M_LOT_KEY                                                            
PRIMARY KEY (                                                                   
M_LOT_ID                                                                        
);                                                                              
ALTER TABLE M_LOTCTL ADD                                                        
CONSTRAINT M_LOTCTL_KEY                                                         
PRIMARY KEY (                                                                   
M_LOTCTL_ID                                                                     
);                                                                              
ALTER TABLE M_MATCHINV ADD                                                      
CONSTRAINT M_MATCHINV_KEY                                                       
PRIMARY KEY (                                                                   
M_MATCHINV_ID                                                                   
);                                                                              
ALTER TABLE M_MATCHPO ADD                                                       
CONSTRAINT M_MATCHPO_KEY                                                        
PRIMARY KEY (                                                                   
M_MATCHPO_ID                                                                    
);                                                                              
ALTER TABLE M_MOVEMENT ADD                                                      
CONSTRAINT M_MOVEMENT_KEY                                                       
PRIMARY KEY (                                                                   
M_MOVEMENT_ID                                                                   
);                                                                              
ALTER TABLE M_MOVEMENTCONFIRM ADD                                               
CONSTRAINT M_MOVEMENTCONFIRM_KEY                                                
PRIMARY KEY (                                                                   
M_MOVEMENTCONFIRM_ID                                                            
);                                                                              
ALTER TABLE M_MOVEMENTLINE ADD                                                  
CONSTRAINT M_MOVEMENTLINE_KEY                                                   
PRIMARY KEY (                                                                   
M_MOVEMENTLINE_ID                                                               
);                                                                              
ALTER TABLE M_MOVEMENTLINECONFIRM ADD                                           
CONSTRAINT M_MOVEMENTLINECONFIRM_KEY                                            
PRIMARY KEY (                                                                   
M_MOVEMENTLINECONFIRM_ID                                                        
);                                                                              
ALTER TABLE M_MOVEMENTLINEMA ADD                                                
CONSTRAINT M_MOVEMENTLINEMA_KEY                                                 
PRIMARY KEY (                                                                   
M_MOVEMENTLINE_ID,                                                              
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
ALTER TABLE M_OPERATIONRESOURCE ADD                                             
CONSTRAINT M_OPERATIONRESOURCE_KEY                                              
PRIMARY KEY (                                                                   
M_OPERATIONRESOURCE_ID                                                          
);                                                                              
ALTER TABLE M_PACKAGE ADD                                                       
CONSTRAINT M_PACKAGE_KEY                                                        
PRIMARY KEY (                                                                   
M_PACKAGE_ID                                                                    
);                                                                              
ALTER TABLE M_PACKAGELINE ADD                                                   
CONSTRAINT M_PACKAGELINE_KEY                                                    
PRIMARY KEY (                                                                   
M_PACKAGELINE_ID                                                                
);                                                                              
ALTER TABLE M_PERPETUALINV ADD                                                  
CONSTRAINT M_PERPETUALINV_KEY                                                   
PRIMARY KEY (                                                                   
M_PERPETUALINV_ID                                                               
);                                                                              
ALTER TABLE M_PRICELIST ADD                                                     
CONSTRAINT M_PRICELIST_KEY                                                      
PRIMARY KEY (                                                                   
M_PRICELIST_ID                                                                  
);                                                                              
ALTER TABLE M_PRICELIST_VERSION ADD                                             
CONSTRAINT M_PRICELIST_VERSION_KEY                                              
PRIMARY KEY (                                                                   
M_PRICELIST_VERSION_ID                                                          
);                                                                              
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT M_PRODUCT_KEY                                                        
PRIMARY KEY (                                                                   
M_PRODUCT_ID                                                                    
);                                                                              
ALTER TABLE M_PRODUCTDOWNLOAD ADD                                               
CONSTRAINT M_PRODUCTDOWNLOAD_KEY                                                
PRIMARY KEY (                                                                   
M_PRODUCTDOWNLOAD_ID                                                            
);                                                                              
ALTER TABLE M_PRODUCTION ADD                                                    
CONSTRAINT M_PRODUCTION_KEY                                                     
PRIMARY KEY (                                                                   
M_PRODUCTION_ID                                                                 
);                                                                              
ALTER TABLE M_PRODUCTIONLINE ADD                                                
CONSTRAINT M_PRODUCTIONLINE_ID                                                  
PRIMARY KEY (                                                                   
M_PRODUCTIONLINE_ID                                                             
);                                                                              
ALTER TABLE M_PRODUCTIONLINEMA ADD                                              
CONSTRAINT M_PRODUCTIONLINEMA_KEY                                               
PRIMARY KEY (                                                                   
M_PRODUCTIONLINE_ID,                                                            
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
ALTER TABLE M_PRODUCTIONPLAN ADD                                                
CONSTRAINT M_PRODUCTIONPLAN_KEY                                                 
PRIMARY KEY (                                                                   
M_PRODUCTIONPLAN_ID                                                             
);                                                                              
ALTER TABLE M_PRODUCTOPERATION ADD                                              
CONSTRAINT M_PRODUCTOPERATION_KEY                                               
PRIMARY KEY (                                                                   
M_PRODUCTOPERATION_ID                                                           
);                                                                              
ALTER TABLE M_PRODUCTPRICE ADD                                                  
CONSTRAINT M_PRODUCTPICE_KEY                                                    
PRIMARY KEY (                                                                   
M_PRICELIST_VERSION_ID,                                                         
M_PRODUCT_ID                                                                    
);                                                                              
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT M_PRODUCT_ACCT_KEY                                                   
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE M_PRODUCT_BOM ADD                                                   
CONSTRAINT M_PRODUCT_BOM_KEY                                                    
PRIMARY KEY (                                                                   
M_PRODUCT_BOM_ID                                                                
);                                                                              
ALTER TABLE M_PRODUCT_CATEGORY ADD                                              
CONSTRAINT M_PRODUCT_CATEGORY_KEY                                               
PRIMARY KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
);                                                                              
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT M_PRODUCT_CATEGORY_ACCT_KEY                                          
PRIMARY KEY (                                                                   
M_PRODUCT_CATEGORY_ID,                                                          
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE M_PRODUCT_COSTING ADD                                               
CONSTRAINT M_PRODUCT_COSTING_KEY                                                
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE M_PRODUCT_PO ADD                                                    
CONSTRAINT M_PRODUCT_PO_KEY                                                     
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
C_BPARTNER_ID                                                                   
);                                                                              
ALTER TABLE M_PRODUCT_TRL ADD                                                   
CONSTRAINT M_PRODUCT_TRL_KEY                                                    
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE M_RELATEDPRODUCT ADD                                                
CONSTRAINT M_RELATEDPRODUCT_KEY                                                 
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
RELATEDPRODUCT_ID,                                                              
RELATEDPRODUCTTYPE                                                              
);                                                                              
ALTER TABLE M_REPLENISH ADD                                                     
CONSTRAINT M_REPLENISH_KEY                                                      
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
M_WAREHOUSE_ID                                                                  
);                                                                              
ALTER TABLE M_REQUISITION ADD                                                   
CONSTRAINT M_REQUISITION_KEY                                                    
PRIMARY KEY (                                                                   
M_REQUISITION_ID                                                                
);                                                                              
ALTER TABLE M_REQUISITIONLINE ADD                                               
CONSTRAINT M_REQUISITIONLINE_KEY                                                
PRIMARY KEY (                                                                   
M_REQUISITIONLINE_ID                                                            
);                                                                              
ALTER TABLE M_RMA ADD                                                           
CONSTRAINT M_RMA_KEY                                                            
PRIMARY KEY (                                                                   
M_RMA_ID                                                                        
);                                                                              
ALTER TABLE M_RMALINE ADD                                                       
CONSTRAINT M_RMALINE_KEY                                                        
PRIMARY KEY (                                                                   
M_RMALINE_ID                                                                    
);                                                                              
ALTER TABLE M_RMATYPE ADD                                                       
CONSTRAINT M_RMATYPE_KEY                                                        
PRIMARY KEY (                                                                   
M_RMATYPE_ID                                                                    
);                                                                              
ALTER TABLE M_SERNOCTL ADD                                                      
CONSTRAINT M_SERNOCTL_KEY                                                       
PRIMARY KEY (                                                                   
M_SERNOCTL_ID                                                                   
);                                                                              
ALTER TABLE M_SHIPPER ADD                                                       
CONSTRAINT M_SHIPPER_KEY                                                        
PRIMARY KEY (                                                                   
M_SHIPPER_ID                                                                    
);                                                                              
ALTER TABLE M_STORAGE ADD                                                       
CONSTRAINT M_STORAGE_KEY                                                        
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
M_LOCATOR_ID,                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
ALTER TABLE M_SUBSTITUTE ADD                                                    
CONSTRAINT M_SUBSTITUTE_KEY                                                     
PRIMARY KEY (                                                                   
M_PRODUCT_ID,                                                                   
SUBSTITUTE_ID                                                                   
);                                                                              
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT M_TRANSACTION_KEY                                                    
PRIMARY KEY (                                                                   
M_TRANSACTION_ID                                                                
);                                                                              
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT M_TRANSACTIONALLOCATION_KEY                                          
PRIMARY KEY (                                                                   
M_TRANSACTION_ID,                                                               
ALLOCATIONSTRATEGYTYPE                                                          
);                                                                              
ALTER TABLE M_WAREHOUSE ADD                                                     
CONSTRAINT M_WAREHOUSE_KEY                                                      
PRIMARY KEY (                                                                   
M_WAREHOUSE_ID                                                                  
);                                                                              
ALTER TABLE M_WAREHOUSE_ACCT ADD                                                
CONSTRAINT M_WAREHOUSE_ACCT_KEY                                                 
PRIMARY KEY (                                                                   
M_WAREHOUSE_ID,                                                                 
C_ACCTSCHEMA_ID                                                                 
);                                                                              
ALTER TABLE PA_ACHIEVEMENT ADD                                                  
CONSTRAINT PA_ACHIEVEMENT_ID                                                    
PRIMARY KEY (                                                                   
PA_ACHIEVEMENT_ID                                                               
);                                                                              
ALTER TABLE PA_COLOR ADD                                                        
CONSTRAINT PA_COLOR_KEY                                                         
PRIMARY KEY (                                                                   
PA_COLOR_ID                                                                     
);                                                                              
ALTER TABLE PA_GOAL ADD                                                         
CONSTRAINT PA_GOAL_KEY                                                          
PRIMARY KEY (                                                                   
PA_GOAL_ID                                                                      
);                                                                              
ALTER TABLE PA_MEASURE ADD                                                      
CONSTRAINT PA_MEASURE_KEY                                                       
PRIMARY KEY (                                                                   
PA_MEASURE_ID                                                                   
);                                                                              
ALTER TABLE PA_MEASURECALC ADD                                                  
CONSTRAINT PA_MEASURECALC_KEY                                                   
PRIMARY KEY (                                                                   
PA_MEASURECALC_ID                                                               
);                                                                              
ALTER TABLE PA_REPORT ADD                                                       
CONSTRAINT PA_REPORT_KEY                                                        
PRIMARY KEY (                                                                   
PA_REPORT_ID                                                                    
);                                                                              
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT PA_REPORTCOLUMN_KEY                                                  
PRIMARY KEY (                                                                   
PA_REPORTCOLUMN_ID                                                              
);                                                                              
ALTER TABLE PA_REPORTCOLUMNSET ADD                                              
CONSTRAINT PA_REPORTCOLUMNSET_KEY                                               
PRIMARY KEY (                                                                   
PA_REPORTCOLUMNSET_ID                                                           
);                                                                              
ALTER TABLE PA_REPORTLINE ADD                                                   
CONSTRAINT PA_REPORTLINE_KEY                                                    
PRIMARY KEY (                                                                   
PA_REPORTLINE_ID                                                                
);                                                                              
ALTER TABLE PA_REPORTLINESET ADD                                                
CONSTRAINT PA_REPORTLINESET_KEY                                                 
PRIMARY KEY (                                                                   
PA_REPORTLINESET_ID                                                             
);                                                                              
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT PA_REPORTSOURCE_KEY                                                  
PRIMARY KEY (                                                                   
PA_REPORTSOURCE_ID                                                              
);                                                                              
ALTER TABLE PA_SLA_CRITERIA ADD                                                 
CONSTRAINT PA_SLA_CRITERIA_KEY                                                  
PRIMARY KEY (                                                                   
PA_SLA_CRITERIA_ID                                                              
);                                                                              
ALTER TABLE PA_SLA_GOAL ADD                                                     
CONSTRAINT PA_SLA_GOAL_KEY                                                      
PRIMARY KEY (                                                                   
PA_SLA_GOAL_ID                                                                  
);                                                                              
ALTER TABLE PA_SLA_MEASURE ADD                                                  
CONSTRAINT PA_SLA_MEASURE_KEY                                                   
PRIMARY KEY (                                                                   
PA_SLA_MEASURE_ID                                                               
);                                                                              
ALTER TABLE R_CATEGORY ADD                                                      
CONSTRAINT R_CATEGORY_KEY                                                       
PRIMARY KEY (                                                                   
R_CATEGORY_ID                                                                   
);                                                                              
ALTER TABLE R_CATEGORYUPDATES ADD                                               
CONSTRAINT R_CATEGORYUPDATES_KEY                                                
PRIMARY KEY (                                                                   
AD_USER_ID,                                                                     
R_CATEGORY_ID                                                                   
);                                                                              
ALTER TABLE R_GROUP ADD                                                         
CONSTRAINT R_GROUP_ID                                                           
PRIMARY KEY (                                                                   
R_GROUP_ID                                                                      
);                                                                              
ALTER TABLE R_GROUPUPDATES ADD                                                  
CONSTRAINT R_GROUPUPDATES_KEY                                                   
PRIMARY KEY (                                                                   
AD_USER_ID,                                                                     
R_GROUP_ID                                                                      
);                                                                              
ALTER TABLE R_INTERESTAREA ADD                                                  
CONSTRAINT R_INTERESTAREA_KEY                                                   
PRIMARY KEY (                                                                   
R_INTERESTAREA_ID                                                               
);                                                                              
ALTER TABLE R_MAILTEXT ADD                                                      
CONSTRAINT R_MAILTEXT_KEY                                                       
PRIMARY KEY (                                                                   
R_MAILTEXT_ID                                                                   
);                                                                              
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT R_REQUEST_KEY                                                        
PRIMARY KEY (                                                                   
R_REQUEST_ID                                                                    
);                                                                              
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT R_REQUESTACTION_KEY                                                  
PRIMARY KEY (                                                                   
R_REQUESTACTION_ID                                                              
);                                                                              
ALTER TABLE R_REQUESTPROCESSOR ADD                                              
CONSTRAINT R_REQUESTPROCESSOR_KEY                                               
PRIMARY KEY (                                                                   
R_REQUESTPROCESSOR_ID                                                           
);                                                                              
ALTER TABLE R_REQUESTPROCESSORLOG ADD                                           
CONSTRAINT R_REQUESTPROCESSORLOG_KEY                                            
PRIMARY KEY (                                                                   
R_REQUESTPROCESSOR_ID,                                                          
R_REQUESTPROCESSORLOG_ID                                                        
);                                                                              
ALTER TABLE R_REQUESTPROCESSOR_ROUTE ADD                                        
CONSTRAINT R_REQUESTPROCESSOR_ROUTE_KEY                                         
PRIMARY KEY (                                                                   
R_REQUESTPROCESSOR_ROUTE_ID                                                     
);                                                                              
ALTER TABLE R_REQUESTTYPE ADD                                                   
CONSTRAINT R_REQUESTTYPE_KEY                                                    
PRIMARY KEY (                                                                   
R_REQUESTTYPE_ID                                                                
);                                                                              
ALTER TABLE R_REQUESTTYPEUPDATES ADD                                            
CONSTRAINT R_REQUESTTYPEUPDATES_KEY                                             
PRIMARY KEY (                                                                   
AD_USER_ID,                                                                     
R_REQUESTTYPE_ID                                                                
);                                                                              
ALTER TABLE R_REQUESTUPDATE ADD                                                 
CONSTRAINT R_REQUESTUPDATE_KEY                                                  
PRIMARY KEY (                                                                   
R_REQUESTUPDATE_ID                                                              
);                                                                              
ALTER TABLE R_REQUESTUPDATES ADD                                                
CONSTRAINT R_REQUESTUPDATES_KEY                                                 
PRIMARY KEY (                                                                   
AD_USER_ID,                                                                     
R_REQUEST_ID                                                                    
);                                                                              
ALTER TABLE R_RESOLUTION ADD                                                    
CONSTRAINT R_RESOLUTION_KEY                                                     
PRIMARY KEY (                                                                   
R_RESOLUTION_ID                                                                 
);                                                                              
ALTER TABLE R_STANDARDRESPONSE ADD                                              
CONSTRAINT R_STANDARDRESPONSE_KEY                                               
PRIMARY KEY (                                                                   
R_STANDARDRESPONSE_ID                                                           
);                                                                              
ALTER TABLE R_STATUS ADD                                                        
CONSTRAINT R_STATUS_KEY                                                         
PRIMARY KEY (                                                                   
R_STATUS_ID                                                                     
);                                                                              
ALTER TABLE S_EXPENSETYPE ADD                                                   
CONSTRAINT S_EXPENSETYPE_KEY                                                    
PRIMARY KEY (                                                                   
S_EXPENSETYPE_ID                                                                
);                                                                              
ALTER TABLE S_RESOURCE ADD                                                      
CONSTRAINT S_RESOURCE_KEY                                                       
PRIMARY KEY (                                                                   
S_RESOURCE_ID                                                                   
);                                                                              
ALTER TABLE S_RESOURCEASSIGNMENT ADD                                            
CONSTRAINT S_RESOURCEASSIGNMENT_KEY                                             
PRIMARY KEY (                                                                   
S_RESOURCEASSIGNMENT_ID                                                         
);                                                                              
ALTER TABLE S_RESOURCETYPE ADD                                                  
CONSTRAINT S_RESOURCETYPE_KEY                                                   
PRIMARY KEY (                                                                   
S_RESOURCETYPE_ID                                                               
);                                                                              
ALTER TABLE S_RESOURCEUNAVAILABLE ADD                                           
CONSTRAINT S_RESOURCEUNAVAILABLE_KEY                                            
PRIMARY KEY (                                                                   
S_RESOURCEUNAVAILABLE_ID                                                        
);                                                                              
ALTER TABLE S_TIMEEXPENSE ADD                                                   
CONSTRAINT S_TIMEEXPENSE_KEY                                                    
PRIMARY KEY (                                                                   
S_TIMEEXPENSE_ID                                                                
);                                                                              
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT S_TIMEEXPENSELINE_KEY                                                
PRIMARY KEY (                                                                   
S_TIMEEXPENSELINE_ID                                                            
);                                                                              
ALTER TABLE S_TIMETYPE ADD                                                      
CONSTRAINT S_TIMETYPE_KEY                                                       
PRIMARY KEY (                                                                   
S_TIMETYPE_ID                                                                   
);                                                                              
ALTER TABLE S_TRAINING ADD                                                      
CONSTRAINT S_TRAINING_KEY                                                       
PRIMARY KEY (                                                                   
S_TRAINING_ID                                                                   
);                                                                              
ALTER TABLE S_TRAINING_CLASS ADD                                                
CONSTRAINT S_TRAINING_CLASS_KEY                                                 
PRIMARY KEY (                                                                   
S_TRAINING_CLASS_ID                                                             
);                                                                              
ALTER TABLE TEST ADD                                                            
CONSTRAINT TEST_KEY                                                             
PRIMARY KEY (                                                                   
TEST_ID                                                                         
);                                                                              
ALTER TABLE TIRE_STORAGE ADD                                                    
CONSTRAINT TIRE_STORAGE_KEY                                                     
PRIMARY KEY (                                                                   
TIRE_STORAGE_ID                                                                 
);                                                                              
ALTER TABLE T_AGING ADD                                                         
CONSTRAINT T_AGING_KEY                                                          
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
C_BPARTNER_ID,                                                                  
C_CURRENCY_ID,                                                                  
C_INVOICE_ID                                                                    
);                                                                              
ALTER TABLE T_DISTRIBUTIONRUNDETAIL ADD                                         
CONSTRAINT T_DISTRIBUTIONRUNDETAIL_KEY                                          
PRIMARY KEY (                                                                   
M_DISTRIBUTIONRUN_ID,                                                           
M_DISTRIBUTIONRUNLINE_ID,                                                       
M_DISTRIBUTIONLIST_ID,                                                          
M_DISTRIBUTIONLISTLINE_ID                                                       
);                                                                              
ALTER TABLE T_INVENTORYVALUE ADD                                                
CONSTRAINT T_INVENTORYVALUE_KEY                                                 
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
M_WAREHOUSE_ID,                                                                 
M_PRODUCT_ID                                                                    
);                                                                              
ALTER TABLE T_INVOICEGL ADD                                                     
CONSTRAINT T_INVOICEGL_KEY                                                      
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
C_INVOICE_ID,                                                                   
FACT_ACCT_ID                                                                    
);                                                                              
ALTER TABLE T_REPLENISH ADD                                                     
CONSTRAINT T_REPLENISH_KEY                                                      
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
M_WAREHOUSE_ID,                                                                 
M_PRODUCT_ID                                                                    
);                                                                              
ALTER TABLE T_REPORT ADD                                                        
CONSTRAINT T_REPORT_KEY                                                         
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
PA_REPORTLINE_ID,                                                               
RECORD_ID,                                                                      
FACT_ACCT_ID                                                                    
);                                                                              
ALTER TABLE T_REPORTSTATEMENT ADD                                               
CONSTRAINT T_REPORTSTATEMENT_KEY                                                
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
FACT_ACCT_ID                                                                    
);                                                                              
ALTER TABLE T_SELECTION ADD                                                     
CONSTRAINT T_SELECTION_KEY                                                      
PRIMARY KEY (                                                                   
T_SELECTION_ID                                                                  
);                                                                              
ALTER TABLE T_SELECTION2 ADD                                                    
CONSTRAINT T_SELECTION2_KEY                                                     
PRIMARY KEY (                                                                   
QUERY_ID,                                                                       
T_SELECTION_ID                                                                  
);                                                                              
ALTER TABLE T_SPOOL ADD                                                         
CONSTRAINT T_SPOOL_KEY                                                          
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
SEQNO                                                                           
);                                                                              
ALTER TABLE T_TRANSACTION ADD                                                   
CONSTRAINT T_TRANSACTION_KEY                                                    
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
M_TRANSACTION_ID                                                                
);                                                                              
ALTER TABLE T_TRIALBALANCE ADD                                                  
CONSTRAINT T_TRIALBALANCE_KEY                                                   
PRIMARY KEY (                                                                   
AD_PINSTANCE_ID,                                                                
FACT_ACCT_ID                                                                    
);                                                                              
ALTER TABLE W_ADVERTISEMENT ADD                                                 
CONSTRAINT W_ADVERTISEMENT_KEY                                                  
PRIMARY KEY (                                                                   
W_ADVERTISEMENT_ID                                                              
);                                                                              
ALTER TABLE W_BASKET ADD                                                        
CONSTRAINT W_BASKET_KEY                                                         
PRIMARY KEY (                                                                   
W_BASKET_ID                                                                     
);                                                                              
ALTER TABLE W_BASKETLINE ADD                                                    
CONSTRAINT W_BASKETLINE_KEY                                                     
PRIMARY KEY (                                                                   
W_BASKETLINE_ID                                                                 
);                                                                              
ALTER TABLE W_CLICK ADD                                                         
CONSTRAINT W_CLICK_KEY                                                          
PRIMARY KEY (                                                                   
W_CLICK_ID                                                                      
);                                                                              
ALTER TABLE W_CLICKCOUNT ADD                                                    
CONSTRAINT W_CLICKCOUNT_KEY                                                     
PRIMARY KEY (                                                                   
W_CLICKCOUNT_ID                                                                 
);                                                                              
ALTER TABLE W_COUNTER ADD                                                       
CONSTRAINT W_COUNTER_KEY                                                        
PRIMARY KEY (                                                                   
W_COUNTER_ID                                                                    
);                                                                              
ALTER TABLE W_COUNTERCOUNT ADD                                                  
CONSTRAINT W_COUNTERCOUNT_KEY                                                   
PRIMARY KEY (                                                                   
W_COUNTERCOUNT_ID                                                               
);                                                                              
ALTER TABLE W_MAILMSG ADD                                                       
CONSTRAINT W_MAILMSG_KEY                                                        
PRIMARY KEY (                                                                   
W_MAILMSG_ID                                                                    
);                                                                              
ALTER TABLE W_MAILMSG_TRL ADD                                                   
CONSTRAINT W_MAILMSG_TRL_KEY                                                    
PRIMARY KEY (                                                                   
W_MAILMSG_ID,                                                                   
AD_LANGUAGE                                                                     
);                                                                              
ALTER TABLE W_STORE ADD                                                         
CONSTRAINT W_STORE_KEY                                                          
PRIMARY KEY (                                                                   
W_STORE_ID                                                                      
);                                                                              
ALTER TABLE W_STORE_TRL ADD                                                     
CONSTRAINT W_STORE_TRL_KEY                                                      
PRIMARY KEY (                                                                   
W_STORE_ID,                                                                     
AD_LANGUAGE                                                                     
);                                                                              
*/
--                                                                              
-- FOREIGN KEYS --                                                              
--                                                                              
ALTER TABLE AD_ACCESSLOG ADD                                                    
CONSTRAINT ADTABLE_ADACCESLOG                                                   
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_ACCESSLOG ADD                                                    
CONSTRAINT ADCOLUMN_ADACCESSLOG                                                 
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_ALERT ADD                                                        
CONSTRAINT CALERTPROCESSOR_ADALERT                                              
FOREIGN KEY (                                                                   
AD_ALERTPROCESSOR_ID                                                            
) REFERENCES AD_ALERTPROCESSOR (                                                
AD_ALERTPROCESSOR_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE AD_ALERTPROCESSOR ADD                                               
CONSTRAINT ADUSER_CALERTPROCESSOR                                               
FOREIGN KEY (                                                                   
SUPERVISOR_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_ALERTPROCESSORLOG ADD                                            
CONSTRAINT CALERTPROCESSOR_LOG                                                  
FOREIGN KEY (                                                                   
AD_ALERTPROCESSOR_ID                                                            
) REFERENCES AD_ALERTPROCESSOR (                                                
AD_ALERTPROCESSOR_ID                                                            
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_ALERTRECIPIENT ADD                                               
CONSTRAINT ADROLE_ADALTERTRECIPIENT                                             
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_ALERTRECIPIENT ADD                                               
CONSTRAINT ADUSER_ADALERTRECIPIENT                                              
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_ALERTRECIPIENT ADD                                               
CONSTRAINT ADALERT_ADALERTRECIPIENT                                             
FOREIGN KEY (                                                                   
AD_ALERT_ID                                                                     
) REFERENCES AD_ALERT (                                                         
AD_ALERT_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_ALERTRULE ADD                                                    
CONSTRAINT ADTABLE_ADALTERTRULE                                                 
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_ALERTRULE ADD                                                    
CONSTRAINT ADALTERT_ARALERTRULE                                                 
FOREIGN KEY (                                                                   
AD_ALERT_ID                                                                     
) REFERENCES AD_ALERT (                                                         
AD_ALERT_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_ARCHIVE ADD                                                      
CONSTRAINT ADPROCESS_ADARCHIVE                                                  
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_ARCHIVE ADD                                                      
CONSTRAINT ADTABLE_ADARCHIVE                                                    
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_ATTACHMENT ADD                                                   
CONSTRAINT ADTABLE_ADATTACHMENT                                                 
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_ATTACHMENTNOTE ADD                                               
CONSTRAINT ADUSER_ADATTACHMENTNOTE                                              
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_ATTACHMENTNOTE ADD                                               
CONSTRAINT ADATTACHMENT_NOTE                                                    
FOREIGN KEY (                                                                   
AD_ATTACHMENT_ID                                                                
) REFERENCES AD_ATTACHMENT (                                                    
AD_ATTACHMENT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_ATTRIBUTE ADD                                                    
CONSTRAINT ADVALRULE_ADATTRIBUTE                                                
FOREIGN KEY (                                                                   
AD_VAL_RULE_ID                                                                  
) REFERENCES AD_VAL_RULE (                                                      
AD_VAL_RULE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_ATTRIBUTE ADD                                                    
CONSTRAINT ADREFERENCE_ADATTRIBUTE                                              
FOREIGN KEY (                                                                   
AD_REFERENCE_ID                                                                 
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_ATTRIBUTE ADD                                                    
CONSTRAINT ADREFERENCEVALUE_ADATTRIBUTE                                         
FOREIGN KEY (                                                                   
AD_REFERENCE_VALUE_ID                                                           
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_ATTRIBUTE ADD                                                    
CONSTRAINT ADTABLE_ADATTRIBUTE                                                  
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_ATTRIBUTE_VALUE ADD                                              
CONSTRAINT ADATTRIBUTE_ADATTRIBUTEVALUE                                         
FOREIGN KEY (                                                                   
AD_ATTRIBUTE_ID                                                                 
) REFERENCES AD_ATTRIBUTE (                                                     
AD_ATTRIBUTE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_CHANGELOG ADD                                                    
CONSTRAINT ADSESSION_ADCHANGELOG                                                
FOREIGN KEY (                                                                   
AD_SESSION_ID                                                                   
) REFERENCES AD_SESSION (                                                       
AD_SESSION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_CHANGELOG ADD                                                    
CONSTRAINT ADCOLUMN_ADCHANGELOG                                                 
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_CHANGELOG ADD                                                    
CONSTRAINT ADTABLE_ADCHANGELOG                                                  
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT ADTREEBPARTNER_ADCLIENTINFO                                          
FOREIGN KEY (                                                                   
AD_TREE_BPARTNER_ID                                                             
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT ADTREESALESREG_ADCLIENTINFO                                          
FOREIGN KEY (                                                                   
AD_TREE_SALESREGION_ID                                                          
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT C_UOM_TIME_AD_CLIENTINFO                                             
FOREIGN KEY (                                                                   
C_UOM_TIME_ID                                                                   
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT CCALENDAR_ADCLIENTINFO                                               
FOREIGN KEY (                                                                   
C_CALENDAR_ID                                                                   
) REFERENCES C_CALENDAR (                                                       
C_CALENDAR_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT CACCTSCHEMA1_ADCLIENTINFO                                            
FOREIGN KEY (                                                                   
C_ACCTSCHEMA1_ID                                                                
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT C_UOM_WEIGHT_AD_CLIENTINFO                                           
FOREIGN KEY (                                                                   
C_UOM_WEIGHT_ID                                                                 
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT ADCLIENT_ADCLIENTINFO                                                
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT ADTREEMENU_ADCLIENTINFO                                              
FOREIGN KEY (                                                                   
AD_TREE_MENU_ID                                                                 
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT ADTREEORG_ADCLIENTINFO                                               
FOREIGN KEY (                                                                   
AD_TREE_ORG_ID                                                                  
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT ADTREEPRODUCT_ADCLIENTINFO                                           
FOREIGN KEY (                                                                   
AD_TREE_PRODUCT_ID                                                              
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT ADTREEPROJECT_ADCLIENTINFO                                           
FOREIGN KEY (                                                                   
AD_TREE_PROJECT_ID                                                              
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT CACCTSCHEMA3_ADCLIENTINFO                                            
FOREIGN KEY (                                                                   
C_ACCTSCHEMA3_ID                                                                
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT C_UOM_LENGTH_AD_CLIENTINFO                                           
FOREIGN KEY (                                                                   
C_UOM_LENGTH_ID                                                                 
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT MPRICELIST_ADCLIENTINFO                                              
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT C_UOM_VOLUME_AD_CLIENTINFO                                           
FOREIGN KEY (                                                                   
C_UOM_VOLUME_ID                                                                 
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT PAGOAL_AD_CLIENTINFO                                                 
FOREIGN KEY (                                                                   
PA_GOAL_ID                                                                      
) REFERENCES PA_GOAL (                                                          
PA_GOAL_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_CLIENTINFO ADD                                                   
CONSTRAINT CACCTSCHEMA2_ADCLIENTINFO                                            
FOREIGN KEY (                                                                   
C_ACCTSCHEMA2_ID                                                                
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_COLOR ADD                                                        
CONSTRAINT ADIMAGE_ADCOLOR                                                      
FOREIGN KEY (                                                                   
AD_IMAGE_ID                                                                     
) REFERENCES AD_IMAGE (                                                         
AD_IMAGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT AD_ELEMENT_AD_COLUMN                                                 
FOREIGN KEY (                                                                   
AD_ELEMENT_ID                                                                   
) REFERENCES AD_ELEMENT (                                                       
AD_ELEMENT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT AD_TABLE_COLUMN                                                      
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT AD_REFERENCE_COLUMNDATATYPE                                          
FOREIGN KEY (                                                                   
AD_REFERENCE_ID                                                                 
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT AD_REFERENCE_COLUMNVALUE                                             
FOREIGN KEY (                                                                   
AD_REFERENCE_VALUE_ID                                                           
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT AD_VALRULE_COLUMN                                                    
FOREIGN KEY (                                                                   
AD_VAL_RULE_ID                                                                  
) REFERENCES AD_VAL_RULE (                                                      
AD_VAL_RULE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT ADPROCESS_ADCOLUMN                                                   
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT COLUMNORG                                                            
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN ADD                                                       
CONSTRAINT COLUMNCLIENT                                                         
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN_ACCESS ADD                                                
CONSTRAINT ADTABLE_ADCOLUMNACCESS                                               
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN_ACCESS ADD                                                
CONSTRAINT ADROLE_ADCOLUMNACCESS                                                
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN_ACCESS ADD                                                
CONSTRAINT ADCOLUMN_ADCOLUMNACCESS                                              
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN_TRL ADD                                                   
CONSTRAINT ADLANGUAGE_ADCOLUMNTRL                                               
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_COLUMN_TRL ADD                                                   
CONSTRAINT ADCOLUMN_ADCOLUMNTRL                                                 
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_DESKTOP ADD                                                      
CONSTRAINT ADIMAGE_ADDESKTOP                                                    
FOREIGN KEY (                                                                   
AD_IMAGE_ID                                                                     
) REFERENCES AD_IMAGE (                                                         
AD_IMAGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_DESKTOP ADD                                                      
CONSTRAINT ADCOLOR_ADDESKTOP                                                    
FOREIGN KEY (                                                                   
AD_COLOR_ID                                                                     
) REFERENCES AD_COLOR (                                                         
AD_COLOR_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_DESKTOPWORKBENCH ADD                                             
CONSTRAINT ADWORKBENCH_ADDESKTOPWB                                              
FOREIGN KEY (                                                                   
AD_WORKBENCH_ID                                                                 
) REFERENCES AD_WORKBENCH (                                                     
AD_WORKBENCH_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_DESKTOPWORKBENCH ADD                                             
CONSTRAINT ADDESKTOP_ADDESKTOPWB                                                
FOREIGN KEY (                                                                   
AD_DESKTOP_ID                                                                   
) REFERENCES AD_DESKTOP (                                                       
AD_DESKTOP_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_DESKTOP_TRL ADD                                                  
CONSTRAINT ADLANGUAGE_ADDESKTOPTRL                                              
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_DESKTOP_TRL ADD                                                  
CONSTRAINT ADDESKTOP_ADDESKTOPTRL                                               
FOREIGN KEY (                                                                   
AD_DESKTOP_ID                                                                   
) REFERENCES AD_DESKTOP (                                                       
AD_DESKTOP_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_ELEMENT_TRL ADD                                                  
CONSTRAINT AD_LANGUAGE_AD_ELEMENT_TRL                                           
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_ELEMENT_TRL ADD                                                  
CONSTRAINT ADELEMENT_ADELEMENTTRL                                               
FOREIGN KEY (                                                                   
AD_ELEMENT_ID                                                                   
) REFERENCES AD_ELEMENT (                                                       
AD_ELEMENT_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_FIELD ADD                                                        
CONSTRAINT FIELDORG                                                             
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_FIELD ADD                                                        
CONSTRAINT AD_TAB_FIELD                                                         
FOREIGN KEY (                                                                   
AD_TAB_ID                                                                       
) REFERENCES AD_TAB (                                                           
AD_TAB_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_FIELD ADD                                                        
CONSTRAINT ADFIELDGROUP_ADFIELD                                                 
FOREIGN KEY (                                                                   
AD_FIELDGROUP_ID                                                                
) REFERENCES AD_FIELDGROUP (                                                    
AD_FIELDGROUP_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_FIELD ADD                                                        
CONSTRAINT AD_COLUMN_FIELD                                                      
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_FIELD ADD                                                        
CONSTRAINT FIELDCLIENT                                                          
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_FIELDGROUP_TRL ADD                                               
CONSTRAINT ADLANGUAGE_ADFIELDGROUPTRL                                           
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_FIELDGROUP_TRL ADD                                               
CONSTRAINT ADFIELDGROUP_TRL                                                     
FOREIGN KEY (                                                                   
AD_FIELDGROUP_ID                                                                
) REFERENCES AD_FIELDGROUP (                                                    
AD_FIELDGROUP_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_FIELD_TRL ADD                                                    
CONSTRAINT AD_LANGUAGE_FIELDTRL                                                 
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_FIELD_TRL ADD                                                    
CONSTRAINT AD_FIELDTRL                                                          
FOREIGN KEY (                                                                   
AD_FIELD_ID                                                                     
) REFERENCES AD_FIELD (                                                         
AD_FIELD_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_FIND ADD                                                         
CONSTRAINT ADCOLUMN_ADFIND                                                      
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_FORM_ACCESS ADD                                                  
CONSTRAINT ADROLE_ADFORMACCESS                                                  
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_FORM_ACCESS ADD                                                  
CONSTRAINT ADFORM_ADFORMACCESS                                                  
FOREIGN KEY (                                                                   
AD_FORM_ID                                                                      
) REFERENCES AD_FORM (                                                          
AD_FORM_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_FORM_TRL ADD                                                     
CONSTRAINT ADLANGUAGE_ADFORMTRL                                                 
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_FORM_TRL ADD                                                     
CONSTRAINT ADFORM_ADFORMTRL                                                     
FOREIGN KEY (                                                                   
AD_FORM_ID                                                                      
) REFERENCES AD_FORM (                                                          
AD_FORM_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_IMPFORMAT ADD                                                    
CONSTRAINT ADTABLE_ADIMPFORMAT                                                  
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_IMPFORMAT_ROW ADD                                                
CONSTRAINT ADCOLUMN_ADIMPFORMATROW                                              
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_IMPFORMAT_ROW ADD                                                
CONSTRAINT ADIMPFORMAT_ADIMPFORMATROW                                           
FOREIGN KEY (                                                                   
AD_IMPFORMAT_ID                                                                 
) REFERENCES AD_IMPFORMAT (                                                     
AD_IMPFORMAT_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_LABELPRINTERFUNCTION ADD                                         
CONSTRAINT ADLABELPRINTER_FUNCTION                                              
FOREIGN KEY (                                                                   
AD_LABELPRINTER_ID                                                              
) REFERENCES AD_LABELPRINTER (                                                  
AD_LABELPRINTER_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE AD_LANGUAGE ADD                                                     
CONSTRAINT LANGUAGEORG                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_LANGUAGE ADD                                                     
CONSTRAINT LANGUAGECLIENT                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT ADMENU_ADWORKBENCH                                                   
FOREIGN KEY (                                                                   
AD_WORKBENCH_ID                                                                 
) REFERENCES AD_WORKBENCH (                                                     
AD_WORKBENCH_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT ADPROCESS_ADMENU                                                     
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT AD_MENU_ORG                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT ADWINDOW_ADMENU                                                      
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT ADFORM_ADMENU                                                        
FOREIGN KEY (                                                                   
AD_FORM_ID                                                                      
) REFERENCES AD_FORM (                                                          
AD_FORM_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT ADCLIENT_ADMENU                                                      
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT ADTASK_ADMENU                                                        
FOREIGN KEY (                                                                   
AD_TASK_ID                                                                      
) REFERENCES AD_TASK (                                                          
AD_TASK_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_MENU ADD                                                         
CONSTRAINT ADWORKFLOW_ADMENU                                                    
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_MENU_TRL ADD                                                     
CONSTRAINT AD_MENUTRL                                                           
FOREIGN KEY (                                                                   
AD_MENU_ID                                                                      
) REFERENCES AD_MENU (                                                          
AD_MENU_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_MENU_TRL ADD                                                     
CONSTRAINT AD_LANGUAGE_MENUTRL                                                  
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_MESSAGE ADD                                                      
CONSTRAINT MESSAGEORG                                                           
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_MESSAGE ADD                                                      
CONSTRAINT MESSAGECLIENT                                                        
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_MESSAGE_TRL ADD                                                  
CONSTRAINT AD_LANGUAGE_MESSAGETRL                                               
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_MESSAGE_TRL ADD                                                  
CONSTRAINT AD_MESSAGETRL                                                        
FOREIGN KEY (                                                                   
AD_MESSAGE_ID                                                                   
) REFERENCES AD_MESSAGE (                                                       
AD_MESSAGE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_NOTE ADD                                                         
CONSTRAINT ADTABLE_ADNOTE                                                       
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_NOTE ADD                                                         
CONSTRAINT ADUSER_ADNOTE                                                        
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_NOTE ADD                                                         
CONSTRAINT ADWFACTIVITY_ADNOTE                                                  
FOREIGN KEY (                                                                   
AD_WF_ACTIVITY_ID                                                               
) REFERENCES AD_WF_ACTIVITY (                                                   
AD_WF_ACTIVITY_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_NOTE ADD                                                         
CONSTRAINT ADMESSAGE_ADNOTE                                                     
FOREIGN KEY (                                                                   
AD_MESSAGE_ID                                                                   
) REFERENCES AD_MESSAGE (                                                       
AD_MESSAGE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_ORG ADD                                                          
CONSTRAINT ADCLIENT_ADORG                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_ORGINFO ADD                                                      
CONSTRAINT ADUSER_ADORGINFO                                                     
FOREIGN KEY (                                                                   
SUPERVISOR_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_ORGINFO ADD                                                      
CONSTRAINT C_LOCATION_AD_ORGINFO                                                
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_ORGINFO ADD                                                      
CONSTRAINT MWAREHOUSE_ADORGINFO                                                 
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_ORGINFO ADD                                                      
CONSTRAINT ADORG_ADORGINFO                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_ORGINFO ADD                                                      
CONSTRAINT ADORGTYPE_ADORGINFO                                                  
FOREIGN KEY (                                                                   
AD_ORGTYPE_ID                                                                   
) REFERENCES AD_ORGTYPE (                                                       
AD_ORGTYPE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_ORGINFO ADD                                                      
CONSTRAINT PAGOAL_AD_ORGINFO                                                    
FOREIGN KEY (                                                                   
PA_GOAL_ID                                                                      
) REFERENCES PA_GOAL (                                                          
PA_GOAL_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_ORGINFO ADD                                                      
CONSTRAINT ADORGPARENT_ADORGINFO                                                
FOREIGN KEY (                                                                   
PARENT_ORG_ID                                                                   
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_PINSTANCE ADD                                                    
CONSTRAINT ADUSER_PINSTANCE                                                     
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_PINSTANCE ADD                                                    
CONSTRAINT ADPROCESS_ADPINSTANCE                                                
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_PINSTANCE_LOG ADD                                                
CONSTRAINT ADPINSTANCE_PILOG                                                    
FOREIGN KEY (                                                                   
AD_PINSTANCE_ID                                                                 
) REFERENCES AD_PINSTANCE (                                                     
AD_PINSTANCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PINSTANCE_PARA ADD                                               
CONSTRAINT ADPINSTANCE_ADPINSTANCEPARA                                          
FOREIGN KEY (                                                                   
AD_PINSTANCE_ID                                                                 
) REFERENCES AD_PINSTANCE (                                                     
AD_PINSTANCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PREFERENCE ADD                                                   
CONSTRAINT AD_WINDOW_PREFERENCE                                                 
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_PREFERENCE ADD                                                   
CONSTRAINT AD_PREFERENCE_ORG                                                    
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_PREFERENCE ADD                                                   
CONSTRAINT AD_PREFERENCE_CLIENT                                                 
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_PREFERENCE ADD                                                   
CONSTRAINT AD_USER_PREFERENCE                                                   
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT ADPRINTFORMAT_FORMINVOICE                                            
FOREIGN KEY (                                                                   
INVOICE_PRINTFORMAT_ID                                                          
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT RMAILTEXT_PROJECTADPRINTFORM                                         
FOREIGN KEY (                                                                   
PROJECT_MAILTEXT_ID                                                             
) REFERENCES R_MAILTEXT (                                                       
R_MAILTEXT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT ADPRINTFORMAT_FORMREMITTANCE                                         
FOREIGN KEY (                                                                   
REMITTANCE_PRINTFORMAT_ID                                                       
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT ADPRINTFORMAT_FORMORDER                                              
FOREIGN KEY (                                                                   
ORDER_PRINTFORMAT_ID                                                            
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT ADPRINTFORMAT_FORMPROJECT                                            
FOREIGN KEY (                                                                   
PROJECT_PRINTFORMAT_ID                                                          
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT ADPRINTFORMAT_FORMSHIPMENT                                           
FOREIGN KEY (                                                                   
SHIPMENT_PRINTFORMAT_ID                                                         
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT RMAILTEXT_ORDERADPRINTFORM                                           
FOREIGN KEY (                                                                   
ORDER_MAILTEXT_ID                                                               
) REFERENCES R_MAILTEXT (                                                       
R_MAILTEXT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT RMAILTEXT_INVOICEADPRINTFORM                                         
FOREIGN KEY (                                                                   
INVOICE_MAILTEXT_ID                                                             
) REFERENCES R_MAILTEXT (                                                       
R_MAILTEXT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT RMAILTEXT_REMITADPRINTFORM                                           
FOREIGN KEY (                                                                   
REMITTANCE_MAILTEXT_ID                                                          
) REFERENCES R_MAILTEXT (                                                       
R_MAILTEXT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT ADCLIENT_ADPRINTFORM                                                 
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORM ADD                                                    
CONSTRAINT RMAILTEXT_SHIPADPRINTFORM                                            
FOREIGN KEY (                                                                   
SHIPMENT_MAILTEXT_ID                                                            
) REFERENCES R_MAILTEXT (                                                       
R_MAILTEXT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMAT ADD                                                  
CONSTRAINT AD_PRINTFONT_ADPRINTFORMAT                                           
FOREIGN KEY (                                                                   
AD_PRINTFONT_ID                                                                 
) REFERENCES AD_PRINTFONT (                                                     
AD_PRINTFONT_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMAT ADD                                                  
CONSTRAINT ADTABLE_ADPRINTFORMAT                                                
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMAT ADD                                                  
CONSTRAINT ADPRINTVIEW_ADPRINTFORMAT                                            
FOREIGN KEY (                                                                   
AD_REPORTVIEW_ID                                                                
) REFERENCES AD_REPORTVIEW (                                                    
AD_REPORTVIEW_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMAT ADD                                                  
CONSTRAINT ADPRINTFORMATTABLE_FORMAT                                            
FOREIGN KEY (                                                                   
AD_PRINTTABLEFORMAT_ID                                                          
) REFERENCES AD_PRINTTABLEFORMAT (                                              
AD_PRINTTABLEFORMAT_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMAT ADD                                                  
CONSTRAINT ADPRINTCOLOR_ADPRINTFORMAT                                           
FOREIGN KEY (                                                                   
AD_PRINTCOLOR_ID                                                                
) REFERENCES AD_PRINTCOLOR (                                                    
AD_PRINTCOLOR_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMAT ADD                                                  
CONSTRAINT ADPRINTPAPER_ADPRINTFORMAT                                           
FOREIGN KEY (                                                                   
AD_PRINTPAPER_ID                                                                
) REFERENCES AD_PRINTPAPER (                                                    
AD_PRINTPAPER_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMATITEM ADD                                              
CONSTRAINT ADPRINTFORMAT_PRINTFORMATCHILD                                       
FOREIGN KEY (                                                                   
AD_PRINTFORMATCHILD_ID                                                          
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMATITEM ADD                                              
CONSTRAINT ADPRINTGRAPH_PRINTFORMATITEM                                         
FOREIGN KEY (                                                                   
AD_PRINTGRAPH_ID                                                                
) REFERENCES AD_PRINTGRAPH (                                                    
AD_PRINTGRAPH_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMATITEM ADD                                              
CONSTRAINT ADPRINTFORMAT_PRINTFORMATITEM                                        
FOREIGN KEY (                                                                   
AD_PRINTFORMAT_ID                                                               
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PRINTFORMATITEM ADD                                              
CONSTRAINT ADCOLUMN_ADPRINTFORMATITEM                                           
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PRINTFORMATITEM ADD                                              
CONSTRAINT ADPRINTCOLOR_ADPRINTFORMATITEM                                       
FOREIGN KEY (                                                                   
AD_PRINTCOLOR_ID                                                                
) REFERENCES AD_PRINTCOLOR (                                                    
AD_PRINTCOLOR_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMATITEM ADD                                              
CONSTRAINT ADPRINTFONT_ADPRINTFORMATITEM                                        
FOREIGN KEY (                                                                   
AD_PRINTFONT_ID                                                                 
) REFERENCES AD_PRINTFONT (                                                     
AD_PRINTFONT_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTFORMATITEM_TRL ADD                                          
CONSTRAINT ADPRINTFORMATITEM_TRL                                                
FOREIGN KEY (                                                                   
AD_PRINTFORMATITEM_ID                                                           
) REFERENCES AD_PRINTFORMATITEM (                                               
AD_PRINTFORMATITEM_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PRINTFORMATITEM_TRL ADD                                          
CONSTRAINT ADLANGUAGE_ADPRINTFORMITEMTRL                                        
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTGRAPH ADD                                                   
CONSTRAINT ADPRINTFORMAT_ADPRINTGRAPH                                           
FOREIGN KEY (                                                                   
AD_PRINTFORMAT_ID                                                               
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTGRAPH ADD                                                   
CONSTRAINT ADPRINTFORMATITEM_GRAPHDATA2                                         
FOREIGN KEY (                                                                   
DATA2_PRINTFORMATITEM_ID                                                        
) REFERENCES AD_PRINTFORMATITEM (                                               
AD_PRINTFORMATITEM_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTGRAPH ADD                                                   
CONSTRAINT ADPRINTFORMATITEM_GRAPHDATA                                          
FOREIGN KEY (                                                                   
DATA_PRINTFORMATITEM_ID                                                         
) REFERENCES AD_PRINTFORMATITEM (                                               
AD_PRINTFORMATITEM_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTGRAPH ADD                                                   
CONSTRAINT ADPRINTFORMATITEM_GRAPHDATA1                                         
FOREIGN KEY (                                                                   
DATA1_PRINTFORMATITEM_ID                                                        
) REFERENCES AD_PRINTFORMATITEM (                                               
AD_PRINTFORMATITEM_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTGRAPH ADD                                                   
CONSTRAINT ADPRINTFORMATITEM_GRAPHDATA3                                         
FOREIGN KEY (                                                                   
DATA3_PRINTFORMATITEM_ID                                                        
) REFERENCES AD_PRINTFORMATITEM (                                               
AD_PRINTFORMATITEM_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTGRAPH ADD                                                   
CONSTRAINT ADPRINTFORMATITEM_GRAPHDATA4                                         
FOREIGN KEY (                                                                   
DATA4_PRINTFORMATITEM_ID                                                        
) REFERENCES AD_PRINTFORMATITEM (                                               
AD_PRINTFORMATITEM_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTGRAPH ADD                                                   
CONSTRAINT ADPRINTFORMATITEM_GRAPHDESCR                                         
FOREIGN KEY (                                                                   
DESCRIPTION_PRINTFORMATITEM_ID                                                  
) REFERENCES AD_PRINTFORMATITEM (                                               
AD_PRINTFORMATITEM_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTLABEL ADD                                                   
CONSTRAINT ADLABELPRINTER_PRINTLABEL                                            
FOREIGN KEY (                                                                   
AD_LABELPRINTER_ID                                                              
) REFERENCES AD_LABELPRINTER (                                                  
AD_LABELPRINTER_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTLABEL ADD                                                   
CONSTRAINT ADTABLE_ADPRINTLABEL                                                 
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTLABELLINE ADD                                               
CONSTRAINT ADPRINTLABEL_ADPRINTLABELLINE                                        
FOREIGN KEY (                                                                   
AD_PRINTLABEL_ID                                                                
) REFERENCES AD_PRINTLABEL (                                                    
AD_PRINTLABEL_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTLABELLINE ADD                                               
CONSTRAINT ADLABELPRINTFUNC_LABELLINE                                           
FOREIGN KEY (                                                                   
AD_LABELPRINTERFUNCTION_ID                                                      
) REFERENCES AD_LABELPRINTERFUNCTION (                                          
AD_LABELPRINTERFUNCTION_ID                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTLABELLINE ADD                                               
CONSTRAINT ADCOLUMN_ADPRINTLABELLINE                                            
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTLABELLINE_TRL ADD                                           
CONSTRAINT ADPRINTLABELLINE_TRL                                                 
FOREIGN KEY (                                                                   
AD_PRINTLABELLINE_ID                                                            
) REFERENCES AD_PRINTLABELLINE (                                                
AD_PRINTLABELLINE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTLABELLINE_TRL ADD                                           
CONSTRAINT ADLANGUAGE_ADPLABELLINETRL                                           
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT ADPRINTCOLOR_TABLEHDRLINE                                            
FOREIGN KEY (                                                                   
HDRLINE_PRINTCOLOR_ID                                                           
) REFERENCES AD_PRINTCOLOR (                                                    
AD_PRINTCOLOR_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT ADPRINTCOLOR_TABLEFUNCTFG                                            
FOREIGN KEY (                                                                   
FUNCTFG_PRINTCOLOR_ID                                                           
) REFERENCES AD_PRINTCOLOR (                                                    
AD_PRINTCOLOR_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT ADPRINTCOLOR_TABLEFUNCTBG                                            
FOREIGN KEY (                                                                   
FUNCTBG_PRINTCOLOR_ID                                                           
) REFERENCES AD_PRINTCOLOR (                                                    
AD_PRINTCOLOR_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT ADPRINTFONT_TABLEFORMATFUNC                                          
FOREIGN KEY (                                                                   
FUNCT_PRINTFONT_ID                                                              
) REFERENCES AD_PRINTFONT (                                                     
AD_PRINTFONT_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT ADPRINTFONT_TABLEHDR                                                 
FOREIGN KEY (                                                                   
HDR_PRINTFONT_ID                                                                
) REFERENCES AD_PRINTFONT (                                                     
AD_PRINTFONT_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT ADPRINTCOLOR_TABLEHDRTEXTFG                                          
FOREIGN KEY (                                                                   
HDRTEXTFG_PRINTCOLOR_ID                                                         
) REFERENCES AD_PRINTCOLOR (                                                    
AD_PRINTCOLOR_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT ADPRINTCOLOR_TABLELINE                                               
FOREIGN KEY (                                                                   
LINE_PRINTCOLOR_ID                                                              
) REFERENCES AD_PRINTCOLOR (                                                    
AD_PRINTCOLOR_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRINTTABLEFORMAT ADD                                             
CONSTRAINT ADPRINTCOLOR_TABLEHDRTEXTBG                                          
FOREIGN KEY (                                                                   
HDRTEXTBG_PRINTCOLOR_ID                                                         
) REFERENCES AD_PRINTCOLOR (                                                    
AD_PRINTCOLOR_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PRIVATE_ACCESS ADD                                               
CONSTRAINT ADUSER_ADPRIVATEACCESS                                               
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_PRIVATE_ACCESS ADD                                               
CONSTRAINT ADTABLE_ADPRIVATEACCESS                                              
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS ADD                                                      
CONSTRAINT ADREPORTVIEW_ADPROCESS                                               
FOREIGN KEY (                                                                   
AD_REPORTVIEW_ID                                                                
) REFERENCES AD_REPORTVIEW (                                                    
AD_REPORTVIEW_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS ADD                                                      
CONSTRAINT ADPRINTFORMAT_ADPROCESS                                              
FOREIGN KEY (                                                                   
AD_PRINTFORMAT_ID                                                               
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS_ACCESS ADD                                               
CONSTRAINT AD_PROCESSTACCESS_ORG                                                
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS_ACCESS ADD                                               
CONSTRAINT AD_PROCESSACCESS_CLIENT                                              
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS_ACCESS ADD                                               
CONSTRAINT ADPROCESS_ADPROCESSACCESS                                            
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PROCESS_ACCESS ADD                                               
CONSTRAINT ADROLE_ADPROCESSACCESS                                               
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PROCESS_PARA ADD                                                 
CONSTRAINT ADVALRULE_AD_PROCESSPARA                                             
FOREIGN KEY (                                                                   
AD_VAL_RULE_ID                                                                  
) REFERENCES AD_VAL_RULE (                                                      
AD_VAL_RULE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS_PARA ADD                                                 
CONSTRAINT ADREFERENCEVALUE_ADPROCPARA                                          
FOREIGN KEY (                                                                   
AD_REFERENCE_VALUE_ID                                                           
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS_PARA ADD                                                 
CONSTRAINT ADPROCESS_ADPROCESSPARA                                              
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PROCESS_PARA ADD                                                 
CONSTRAINT ADREFERENCE_ADPROCESSPARA                                            
FOREIGN KEY (                                                                   
AD_REFERENCE_ID                                                                 
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS_PARA ADD                                                 
CONSTRAINT ADELEMENT_ADPROCESSPARA                                              
FOREIGN KEY (                                                                   
AD_ELEMENT_ID                                                                   
) REFERENCES AD_ELEMENT (                                                       
AD_ELEMENT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS_PARA_TRL ADD                                             
CONSTRAINT ADPROCPARA_ADPROCPARATRL                                             
FOREIGN KEY (                                                                   
AD_PROCESS_PARA_ID                                                              
) REFERENCES AD_PROCESS_PARA (                                                  
AD_PROCESS_PARA_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PROCESS_PARA_TRL ADD                                             
CONSTRAINT ADLANGUAGE_ADPROCESSPARATRL                                          
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_PROCESS_TRL ADD                                                  
CONSTRAINT AD_PROCESS_AD_PROCESS_TRL                                            
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_PROCESS_TRL ADD                                                  
CONSTRAINT AD_LANGUAGE_AD_PROCESS_TRL                                           
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_RECORD_ACCESS ADD                                                
CONSTRAINT ADTABLE_ADRECORDACCESS                                               
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_RECORD_ACCESS ADD                                                
CONSTRAINT ADROLE_ARDECORDACCESS                                                
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_REFERENCE ADD                                                    
CONSTRAINT REFERENCEORG                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_REFERENCE ADD                                                    
CONSTRAINT REFERENCECLIENT                                                      
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_REFERENCE_TRL ADD                                                
CONSTRAINT AD_REFERENCETRL                                                      
FOREIGN KEY (                                                                   
AD_REFERENCE_ID                                                                 
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_REFERENCE_TRL ADD                                                
CONSTRAINT AD_LANGUAGE_REFERENCETRL                                             
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_REF_LIST ADD                                                     
CONSTRAINT AD_REFLIST_ORG                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_REF_LIST ADD                                                     
CONSTRAINT AD_REFLIST_CLIENT                                                    
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_REF_LIST ADD                                                     
CONSTRAINT AD_REFERENCE_REFLIST                                                 
FOREIGN KEY (                                                                   
AD_REFERENCE_ID                                                                 
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_REF_LIST_TRL ADD                                                 
CONSTRAINT AD_LANGUAGE_REFLISTTRL                                               
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_REF_LIST_TRL ADD                                                 
CONSTRAINT AD_REFLISTTRL                                                        
FOREIGN KEY (                                                                   
AD_REF_LIST_ID                                                                  
) REFERENCES AD_REF_LIST (                                                      
AD_REF_LIST_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_REF_TABLE ADD                                                    
CONSTRAINT REF_TABLEORG                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_REF_TABLE ADD                                                    
CONSTRAINT AD_REFERENCE_REFTABLE                                                
FOREIGN KEY (                                                                   
AD_REFERENCE_ID                                                                 
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_REF_TABLE ADD                                                    
CONSTRAINT ADD_TABLE_REFTABLE                                                   
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_REF_TABLE ADD                                                    
CONSTRAINT AD_COLUMN_REFTABLE_DISPLAY                                           
FOREIGN KEY (                                                                   
AD_DISPLAY                                                                      
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_REF_TABLE ADD                                                    
CONSTRAINT AD_COLUMN_REFTABLE_ID                                                
FOREIGN KEY (                                                                   
AD_KEY                                                                          
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_REF_TABLE ADD                                                    
CONSTRAINT REF_TABLECLIENT                                                      
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_REPLICATION ADD                                                  
CONSTRAINT ADREPLICATIONSTRATEGY_ADREP                                          
FOREIGN KEY (                                                                   
AD_REPLICATIONSTRATEGY_ID                                                       
) REFERENCES AD_REPLICATIONSTRATEGY (                                           
AD_REPLICATIONSTRATEGY_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_REPLICATIONTABLE ADD                                             
CONSTRAINT ADTABLE_ADREPLICATIONTABLE                                           
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_REPLICATIONTABLE ADD                                             
CONSTRAINT ADREPSTRATEGY_ADREPTABLE                                             
FOREIGN KEY (                                                                   
AD_REPLICATIONSTRATEGY_ID                                                       
) REFERENCES AD_REPLICATIONSTRATEGY (                                           
AD_REPLICATIONSTRATEGY_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_REPLICATION_LOG ADD                                              
CONSTRAINT ADREPLICATIONRUN_ADREPLOG                                            
FOREIGN KEY (                                                                   
AD_REPLICATION_RUN_ID                                                           
) REFERENCES AD_REPLICATION_RUN (                                               
AD_REPLICATION_RUN_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_REPLICATION_LOG ADD                                              
CONSTRAINT ADREPTABLE_ADREPLOG                                                  
FOREIGN KEY (                                                                   
AD_REPLICATIONTABLE_ID                                                          
) REFERENCES AD_REPLICATIONTABLE (                                              
AD_REPLICATIONTABLE_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE AD_REPLICATION_RUN ADD                                              
CONSTRAINT ADREPLICATION_ADREPRUN                                               
FOREIGN KEY (                                                                   
AD_REPLICATION_ID                                                               
) REFERENCES AD_REPLICATION (                                                   
AD_REPLICATION_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_REPORTVIEW ADD                                                   
CONSTRAINT ADTABLE_ADREPORTVIEW                                                 
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_REPORTVIEW_COL ADD                                               
CONSTRAINT ADREPORTVIEW_COL                                                     
FOREIGN KEY (                                                                   
AD_REPORTVIEW_ID                                                                
) REFERENCES AD_REPORTVIEW (                                                    
AD_REPORTVIEW_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_REPORTVIEW_COL ADD                                               
CONSTRAINT ADCOLUMN_ADREPORTVIEWCOL                                             
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_ROLE ADD                                                         
CONSTRAINT C_CURRENCY_AD_ROLE                                                   
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_ROLE ADD                                                         
CONSTRAINT AD_ROLEORG                                                           
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_ROLE ADD                                                         
CONSTRAINT AD_ROLECLIENT                                                        
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_ROLE ADD                                                         
CONSTRAINT ADUSERSUPERVISOR_ADROLE                                              
FOREIGN KEY (                                                                   
SUPERVISOR_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_ROLE ADD                                                         
CONSTRAINT ADTREE_ADROLE                                                        
FOREIGN KEY (                                                                   
AD_TREE_MENU_ID                                                                 
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_ROLE_ORGACCESS ADD                                               
CONSTRAINT ADROLE_ADROLEORGACCESS                                               
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_ROLE_ORGACCESS ADD                                               
CONSTRAINT ADORG_ADROLEORGACCESS                                                
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_SCHEDULER ADD                                                    
CONSTRAINT ADPROCESS_ADSCHEDULER                                                
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_SCHEDULER ADD                                                    
CONSTRAINT ADUSER_ADSCHEDULER                                                   
FOREIGN KEY (                                                                   
SUPERVISOR_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_SCHEDULERLOG ADD                                                 
CONSTRAINT ADSCHEDULER_LOG                                                      
FOREIGN KEY (                                                                   
AD_SCHEDULER_ID                                                                 
) REFERENCES AD_SCHEDULER (                                                     
AD_SCHEDULER_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_SCHEDULERRECIPIENT ADD                                           
CONSTRAINT ADSCHEDULER_RECIPIENT                                                
FOREIGN KEY (                                                                   
AD_SCHEDULER_ID                                                                 
) REFERENCES AD_SCHEDULER (                                                     
AD_SCHEDULER_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_SCHEDULERRECIPIENT ADD                                           
CONSTRAINT ADUSER_ADSCHEDULERRECIPIENT                                          
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_SCHEDULERRECIPIENT ADD                                           
CONSTRAINT ADROLE_ADSCHEDULERRECIPIENT                                          
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_SCHEDULER_PARA ADD                                               
CONSTRAINT ADSCHEDULER_ADSCHEDULERPARA                                          
FOREIGN KEY (                                                                   
AD_SCHEDULER_ID                                                                 
) REFERENCES AD_SCHEDULER (                                                     
AD_SCHEDULER_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_SCHEDULER_PARA ADD                                               
CONSTRAINT ADPROCESSPARA_ADSCHEDULERPARA                                        
FOREIGN KEY (                                                                   
AD_PROCESS_PARA_ID                                                              
) REFERENCES AD_PROCESS_PARA (                                                  
AD_PROCESS_PARA_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_SEQUENCE ADD                                                     
CONSTRAINT SEQUENCEORG                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_SEQUENCE ADD                                                     
CONSTRAINT SEQUENCECLIENT                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_SEQUENCE_AUDIT ADD                                               
CONSTRAINT ADTABLE_ADSEQUENCEAUDIT                                              
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_SEQUENCE_AUDIT ADD                                               
CONSTRAINT AD_SEQUENCE_SEQUENCEAUDIT                                            
FOREIGN KEY (                                                                   
AD_SEQUENCE_ID                                                                  
) REFERENCES AD_SEQUENCE (                                                      
AD_SEQUENCE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_SEQUENCE_AUDIT ADD                                               
CONSTRAINT SEQUENCE_AUDITORG                                                    
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_SEQUENCE_AUDIT ADD                                               
CONSTRAINT SEQUENCE_AUDITCLIENT                                                 
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_SEQUENCE_NO ADD                                                  
CONSTRAINT SEQUENCE_NOORG                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_SEQUENCE_NO ADD                                                  
CONSTRAINT SEQUENCE_NOCLIENT                                                    
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_SEQUENCE_NO ADD                                                  
CONSTRAINT AD_SEQUENCE_SEQUENCENO                                               
FOREIGN KEY (                                                                   
AD_SEQUENCE_ID                                                                  
) REFERENCES AD_SEQUENCE (                                                      
AD_SEQUENCE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT TABORG                                                               
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT ADCOLUMN_ADTABSORTORDER                                              
FOREIGN KEY (                                                                   
AD_COLUMNSORTORDER_ID                                                           
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT ADCOLUMN_ADTABSORTYESNO                                              
FOREIGN KEY (                                                                   
AD_COLUMNSORTYESNO_ID                                                           
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT ADIMAGE_ADTAB                                                        
FOREIGN KEY (                                                                   
AD_IMAGE_ID                                                                     
) REFERENCES AD_IMAGE (                                                         
AD_IMAGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT ADPROCESS_ADTAB                                                      
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT ADTAB_INCLUDED                                                       
FOREIGN KEY (                                                                   
INCLUDED_TAB_ID                                                                 
) REFERENCES AD_TAB (                                                           
AD_TAB_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT AD_COLUMN_AD_TAB                                                     
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT AD_TABLE_TAB                                                         
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT AD_WINDOW_TAB                                                        
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TAB ADD                                                          
CONSTRAINT TABCLIENT                                                            
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TABLE ADD                                                        
CONSTRAINT TABLEORG                                                             
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_TABLE ADD                                                        
CONSTRAINT AD_WINDOW_TABLE                                                      
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TABLE ADD                                                        
CONSTRAINT TABLECLIENT                                                          
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TABLE ADD                                                        
CONSTRAINT ADWINDOWPO_ADTABLE                                                   
FOREIGN KEY (                                                                   
PO_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TABLE ADD                                                        
CONSTRAINT AD_VALRULE_TABLE                                                     
FOREIGN KEY (                                                                   
AD_VAL_RULE_ID                                                                  
) REFERENCES AD_VAL_RULE (                                                      
AD_VAL_RULE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_TABLE_ACCESS ADD                                                 
CONSTRAINT ADROLE_ADTABLEACCESS                                                 
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TABLE_ACCESS ADD                                                 
CONSTRAINT ADTABLE_ADTABLEACCESS                                                
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TABLE_ACCESS ADD                                                 
CONSTRAINT AD_DATAACCESSCLIENT                                                  
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TABLE_ACCESS ADD                                                 
CONSTRAINT AD_DATAACCESSORG                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_TABLE_TRL ADD                                                    
CONSTRAINT ADTABLE_ADTABLETRL                                                   
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TABLE_TRL ADD                                                    
CONSTRAINT ADLANGUAGE_ADTABLETRL                                                
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_TAB_TRL ADD                                                      
CONSTRAINT AD_TABTRL                                                            
FOREIGN KEY (                                                                   
AD_TAB_ID                                                                       
) REFERENCES AD_TAB (                                                           
AD_TAB_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TAB_TRL ADD                                                      
CONSTRAINT AD_LANGUAGE_TABTRL                                                   
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_TASK ADD                                                         
CONSTRAINT TASKORG                                                              
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_TASK ADD                                                         
CONSTRAINT TASKCLIENT                                                           
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TASKINSTANCE ADD                                                 
CONSTRAINT TASKINSTANCECLIENT                                                   
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TASKINSTANCE ADD                                                 
CONSTRAINT AD_TASK_TASKINSTANCE                                                 
FOREIGN KEY (                                                                   
AD_TASK_ID                                                                      
) REFERENCES AD_TASK (                                                          
AD_TASK_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TASKINSTANCE ADD                                                 
CONSTRAINT TASKINSTANCEORG                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_TASK_ACCESS ADD                                                  
CONSTRAINT ADTASK_ADTASKACCESS                                                  
FOREIGN KEY (                                                                   
AD_TASK_ID                                                                      
) REFERENCES AD_TASK (                                                          
AD_TASK_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TASK_ACCESS ADD                                                  
CONSTRAINT AD_TASKACCESS_CLIENT                                                 
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_TASK_ACCESS ADD                                                  
CONSTRAINT AD_TASKACCESS_ORG                                                    
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_TASK_ACCESS ADD                                                  
CONSTRAINT ADROLE_ADTASKACCESS                                                  
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TASK_TRL ADD                                                     
CONSTRAINT AD_TASKTRL                                                           
FOREIGN KEY (                                                                   
AD_TASK_ID                                                                      
) REFERENCES AD_TASK (                                                          
AD_TASK_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TASK_TRL ADD                                                     
CONSTRAINT AD_LANGUAGE_TASKTRL                                                  
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_TREEBAR ADD                                                      
CONSTRAINT ADTREE_ADTREEBAR                                                     
FOREIGN KEY (                                                                   
AD_TREE_ID                                                                      
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TREEBAR ADD                                                      
CONSTRAINT ADUSER_ADTREEBAR                                                     
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TREENODE ADD                                                     
CONSTRAINT ADTREE_ADTREENODE                                                    
FOREIGN KEY (                                                                   
AD_TREE_ID                                                                      
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TREENODEBP ADD                                                   
CONSTRAINT ADTREE_ADTREENODEBP                                                  
FOREIGN KEY (                                                                   
AD_TREE_ID                                                                      
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TREENODEMM ADD                                                   
CONSTRAINT ADTREE_ADTREENODEMM                                                  
FOREIGN KEY (                                                                   
AD_TREE_ID                                                                      
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_TREENODEPR ADD                                                   
CONSTRAINT ADTREE_ADTREENODEPR                                                  
FOREIGN KEY (                                                                   
AD_TREE_ID                                                                      
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT AD_USER_ORG                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT PAGOAL_ADUSER                                                        
FOREIGN KEY (                                                                   
PA_GOAL_ID                                                                      
) REFERENCES PA_GOAL (                                                          
PA_GOAL_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT CBPARTNER_ADUSER                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT PAGOALPRIVATE_ADUSER                                                 
FOREIGN KEY (                                                                   
PA_GOALPRIVATE_ID                                                               
) REFERENCES PA_GOAL (                                                          
PA_GOAL_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT CBPLOCATION_ADUSER                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT ADUSER_SUPERVISOR                                                    
FOREIGN KEY (                                                                   
SUPERVISOR_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT ADORGTRX_ADUSER                                                      
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT CGREETING_ADUSER                                                     
FOREIGN KEY (                                                                   
C_GREETING_ID                                                                   
) REFERENCES C_GREETING (                                                       
C_GREETING_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_USER ADD                                                         
CONSTRAINT AD_USER_CLIENT                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_USERDEF_FIELD ADD                                                
CONSTRAINT ADUSERDEFTAB_ADUSERDEFFIELD                                          
FOREIGN KEY (                                                                   
AD_USERDEF_TAB_ID                                                               
) REFERENCES AD_USERDEF_TAB (                                                   
AD_USERDEF_TAB_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_USERDEF_FIELD ADD                                                
CONSTRAINT ADFIELD_ADUSERDEFFIELD                                               
FOREIGN KEY (                                                                   
AD_FIELD_ID                                                                     
) REFERENCES AD_FIELD (                                                         
AD_FIELD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_USERDEF_TAB ADD                                                  
CONSTRAINT ADUSERDEFWIN_ADUSERDEFTAB                                            
FOREIGN KEY (                                                                   
AD_USERDEF_WIN_ID                                                               
) REFERENCES AD_USERDEF_WIN (                                                   
AD_USERDEF_WIN_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE AD_USERDEF_TAB ADD                                                  
CONSTRAINT ADTAB_ADUSERDEFTAB                                                   
FOREIGN KEY (                                                                   
AD_TAB_ID                                                                       
) REFERENCES AD_TAB (                                                           
AD_TAB_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_USERDEF_WIN ADD                                                  
CONSTRAINT ADUSER_ADUSERDEFWIN                                                  
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_USERDEF_WIN ADD                                                  
CONSTRAINT ADROLE_ADUSERDEFWIN                                                  
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_USERDEF_WIN ADD                                                  
CONSTRAINT ADWINDOW_ADUSERDEFWIN                                                
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_USERMAIL ADD                                                     
CONSTRAINT ADUSER_ADUSERMAIL                                                    
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_USERMAIL ADD                                                     
CONSTRAINT WMAILMSG_ADUSERMAIL                                                  
FOREIGN KEY (                                                                   
W_MAILMSG_ID                                                                    
) REFERENCES W_MAILMSG (                                                        
W_MAILMSG_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_USERMAIL ADD                                                     
CONSTRAINT RMAILTEXT_ADUSERMAIL                                                 
FOREIGN KEY (                                                                   
R_MAILTEXT_ID                                                                   
) REFERENCES R_MAILTEXT (                                                       
R_MAILTEXT_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_USER_ORGACCESS ADD                                               
CONSTRAINT ADORG_ADUSERORGACCESS                                                
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_USER_ORGACCESS ADD                                               
CONSTRAINT ADUSER_ADUSERORGACCESS                                               
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_USER_ROLES ADD                                                   
CONSTRAINT AD_USERROLESORG                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_USER_ROLES ADD                                                   
CONSTRAINT ADUSER_USERROLES                                                     
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_USER_ROLES ADD                                                   
CONSTRAINT ADROLE_ADUSERROLES                                                   
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_USER_ROLES ADD                                                   
CONSTRAINT AD_USERROLESCLIENT                                                   
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_USER_SUBSTITUTE ADD                                              
CONSTRAINT ADUSERSUB_AD_USERSUB                                                 
FOREIGN KEY (                                                                   
SUBSTITUTE_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_USER_SUBSTITUTE ADD                                              
CONSTRAINT ADUSER_ADUSERSUB                                                     
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_VAL_RULE ADD                                                     
CONSTRAINT VAL_RULECLIENT                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_VAL_RULE ADD                                                     
CONSTRAINT VAL_RULEORG                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WF_ACTIVITY ADD                                                  
CONSTRAINT ADMESSAGE_ADWFACTIVITY                                               
FOREIGN KEY (                                                                   
AD_MESSAGE_ID                                                                   
) REFERENCES AD_MESSAGE (                                                       
AD_MESSAGE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_WF_ACTIVITY ADD                                                  
CONSTRAINT ADWFRESPONSIBLE_ADWFACTIVITY                                         
FOREIGN KEY (                                                                   
AD_WF_RESPONSIBLE_ID                                                            
) REFERENCES AD_WF_RESPONSIBLE (                                                
AD_WF_RESPONSIBLE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE AD_WF_ACTIVITY ADD                                                  
CONSTRAINT ADWFPROCESS_ADWFACTIVITY                                             
FOREIGN KEY (                                                                   
AD_WF_PROCESS_ID                                                                
) REFERENCES AD_WF_PROCESS (                                                    
AD_WF_PROCESS_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_ACTIVITY ADD                                                  
CONSTRAINT ADUSER_ADWFACTIVITY                                                  
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WF_ACTIVITY ADD                                                  
CONSTRAINT ADWFNODE_ADWFACTIVITY                                                
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_ACTIVITYRESULT ADD                                            
CONSTRAINT ADWFACTIVITY_ADWFACTRESULT                                           
FOREIGN KEY (                                                                   
AD_WF_ACTIVITY_ID                                                               
) REFERENCES AD_WF_ACTIVITY (                                                   
AD_WF_ACTIVITY_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_BLOCK ADD                                                     
CONSTRAINT ADWORKFLOW_ADWFBLOCK                                                 
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_EVENTAUDIT ADD                                                
CONSTRAINT ADWFRESPONSIB_ADWFEVENTAUDIT                                         
FOREIGN KEY (                                                                   
AD_WF_RESPONSIBLE_ID                                                            
) REFERENCES AD_WF_RESPONSIBLE (                                                
AD_WF_RESPONSIBLE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE AD_WF_EVENTAUDIT ADD                                                
CONSTRAINT ADWFNODE_ADWFEVENTAUDIT                                              
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_WF_EVENTAUDIT ADD                                                
CONSTRAINT ADTABLE_ADWFEVENTAUDIT                                               
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WF_EVENTAUDIT ADD                                                
CONSTRAINT ADUSER_ADWFEVENTAUDIT                                                
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WF_EVENTAUDIT ADD                                                
CONSTRAINT ADWFPROCESS_ADWFEVENTAUDIT                                           
FOREIGN KEY (                                                                   
AD_WF_PROCESS_ID                                                                
) REFERENCES AD_WF_PROCESS (                                                    
AD_WF_PROCESS_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NEXTCONDITION ADD                                             
CONSTRAINT ADCOLUMN_ADWFNEXTCONDITION                                           
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NEXTCONDITION ADD                                             
CONSTRAINT ADWFNODENEXT_ADWFNEXTCOND                                            
FOREIGN KEY (                                                                   
AD_WF_NODENEXT_ID                                                               
) REFERENCES AD_WF_NODENEXT (                                                   
AD_WF_NODENEXT_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADWINDOW_ADWFNODE                                                    
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADWFRESPONSIBLE_ADWFNODE                                             
FOREIGN KEY (                                                                   
AD_WF_RESPONSIBLE_ID                                                            
) REFERENCES AD_WF_RESPONSIBLE (                                                
AD_WF_RESPONSIBLE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADTASK_ADWFNODE                                                      
FOREIGN KEY (                                                                   
AD_TASK_ID                                                                      
) REFERENCES AD_TASK (                                                          
AD_TASK_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADFORM_ADWFNODE                                                      
FOREIGN KEY (                                                                   
AD_FORM_ID                                                                      
) REFERENCES AD_FORM (                                                          
AD_FORM_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADIMAGE_ADWFNODE                                                     
FOREIGN KEY (                                                                   
AD_IMAGE_ID                                                                     
) REFERENCES AD_IMAGE (                                                         
AD_IMAGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADPROCESS_ADWFNODE                                                   
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADWFBLOCK_ADWFNODE                                                   
FOREIGN KEY (                                                                   
AD_WF_BLOCK_ID                                                                  
) REFERENCES AD_WF_BLOCK (                                                      
AD_WF_BLOCK_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADWORKFLOW_ADWFNODE                                                  
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT WF_NODEORG                                                           
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT WF_NODECLIENT                                                        
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE ADD                                                      
CONSTRAINT ADWORKFLOW_ADWFNODESUBFLOW                                           
FOREIGN KEY (                                                                   
WORKFLOW_ID                                                                     
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODENEXT ADD                                                  
CONSTRAINT WF_NODENEXTORG                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODENEXT ADD                                                  
CONSTRAINT WF_NODENEXTCLIENT                                                    
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODENEXT ADD                                                  
CONSTRAINT ADWFNODENEXT_ADWFNODENEXT                                            
FOREIGN KEY (                                                                   
AD_WF_NEXT_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_NODENEXT ADD                                                  
CONSTRAINT ADWFNODE_ADWFNODENEXT                                                
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_NODE_PARA ADD                                                 
CONSTRAINT ADWFNODE_ADWFNODEPARA                                                
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_WF_NODE_PARA ADD                                                 
CONSTRAINT ADPROCESSPARA_ADWFNODEPARA                                           
FOREIGN KEY (                                                                   
AD_PROCESS_PARA_ID                                                              
) REFERENCES AD_PROCESS_PARA (                                                  
AD_PROCESS_PARA_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_NODE_TRL ADD                                                  
CONSTRAINT AD_WFNODETRL                                                         
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_NODE_TRL ADD                                                  
CONSTRAINT AD_LANGUAGE_WFNODETRL                                                
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WF_PROCESS ADD                                                   
CONSTRAINT ADWORKFLOW_ADWFPROCESS                                               
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_PROCESS ADD                                                   
CONSTRAINT WF_INSTANCECLIENT                                                    
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WF_PROCESS ADD                                                   
CONSTRAINT ADUSER_ADWFPROCESS                                                   
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WF_PROCESS ADD                                                   
CONSTRAINT WF_INSTANCEORG                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WF_PROCESS ADD                                                   
CONSTRAINT ADWFRESPONSIBLE_ADWFPROCESS                                          
FOREIGN KEY (                                                                   
AD_WF_RESPONSIBLE_ID                                                            
) REFERENCES AD_WF_RESPONSIBLE (                                                
AD_WF_RESPONSIBLE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE AD_WF_PROCESS ADD                                                   
CONSTRAINT ADMESSAGE_ADWFPROCESS                                                
FOREIGN KEY (                                                                   
AD_MESSAGE_ID                                                                   
) REFERENCES AD_MESSAGE (                                                       
AD_MESSAGE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_WF_PROCESSDATA ADD                                               
CONSTRAINT ADWFPROCCESS_ADWFPROCESSDATA                                         
FOREIGN KEY (                                                                   
AD_WF_PROCESS_ID                                                                
) REFERENCES AD_WF_PROCESS (                                                    
AD_WF_PROCESS_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WF_RESPONSIBLE ADD                                               
CONSTRAINT ADROLE_ADWFRESPONSIBLE                                               
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WF_RESPONSIBLE ADD                                               
CONSTRAINT ADORG_ADWFRESPONSIBLE                                                
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WF_RESPONSIBLE ADD                                               
CONSTRAINT ADUSER_ADWFRESPONSIBLE                                               
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WINDOW ADD                                                       
CONSTRAINT ADCOLOR_ADWINDOW                                                     
FOREIGN KEY (                                                                   
AD_COLOR_ID                                                                     
) REFERENCES AD_COLOR (                                                         
AD_COLOR_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WINDOW ADD                                                       
CONSTRAINT WINDOWORG                                                            
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WINDOW ADD                                                       
CONSTRAINT WINDOWCLIENT                                                         
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WINDOW ADD                                                       
CONSTRAINT ADIMAGE_ADWINDOW                                                     
FOREIGN KEY (                                                                   
AD_IMAGE_ID                                                                     
) REFERENCES AD_IMAGE (                                                         
AD_IMAGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WINDOW_ACCESS ADD                                                
CONSTRAINT ADROLE_ADWINDOWACCESS                                                
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WINDOW_ACCESS ADD                                                
CONSTRAINT AD_FUNCTACCESS_CLIENT                                                
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WINDOW_ACCESS ADD                                                
CONSTRAINT ADWINDOW_ADWINDOWACCESS                                              
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WINDOW_ACCESS ADD                                                
CONSTRAINT AD_FUNCTACCESSORG                                                    
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WINDOW_TRL ADD                                                   
CONSTRAINT AD_WINDOWTRL                                                         
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WINDOW_TRL ADD                                                   
CONSTRAINT AD_LANGUAGE_WINDOWTRL                                                
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCH ADD                                                    
CONSTRAINT ADCOLOR_ADWORKBENCH                                                  
FOREIGN KEY (                                                                   
AD_COLOR_ID                                                                     
) REFERENCES AD_COLOR (                                                         
AD_COLOR_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCH ADD                                                    
CONSTRAINT PAGOAL_ADWORKBENCH                                                   
FOREIGN KEY (                                                                   
PA_GOAL_ID                                                                      
) REFERENCES PA_GOAL (                                                          
PA_GOAL_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCH ADD                                                    
CONSTRAINT ADIMAGE_ADWORKBENCH                                                  
FOREIGN KEY (                                                                   
AD_IMAGE_ID                                                                     
) REFERENCES AD_IMAGE (                                                         
AD_IMAGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCHWINDOW ADD                                              
CONSTRAINT ADWORKBENCH_ADWORKBENCHWINDOW                                        
FOREIGN KEY (                                                                   
AD_WORKBENCH_ID                                                                 
) REFERENCES AD_WORKBENCH (                                                     
AD_WORKBENCH_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCHWINDOW ADD                                              
CONSTRAINT ADPROCESS_ADWORKBENCHWINDOW                                          
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCHWINDOW ADD                                              
CONSTRAINT ADWINDOW_ADWORKBENCHWINDOW                                           
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCHWINDOW ADD                                              
CONSTRAINT ADTASK_ADWORKBENCHWINDOW                                             
FOREIGN KEY (                                                                   
AD_TASK_ID                                                                      
) REFERENCES AD_TASK (                                                          
AD_TASK_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCHWINDOW ADD                                              
CONSTRAINT ADFORM_ADWORKBENCHWINDOW                                             
FOREIGN KEY (                                                                   
AD_FORM_ID                                                                      
) REFERENCES AD_FORM (                                                          
AD_FORM_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCH_TRL ADD                                                
CONSTRAINT ADWORKBENCH_ADWORKBENCHTRL                                           
FOREIGN KEY (                                                                   
AD_WORKBENCH_ID                                                                 
) REFERENCES AD_WORKBENCH (                                                     
AD_WORKBENCH_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE AD_WORKBENCH_TRL ADD                                                
CONSTRAINT ADLANGUAGE_ADWORKBENCHTRL                                            
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOW ADD                                                     
CONSTRAINT WORKFLOWORG                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOW ADD                                                     
CONSTRAINT ADWFRESPONSIBLE_ADWORKFLOW                                           
FOREIGN KEY (                                                                   
AD_WF_RESPONSIBLE_ID                                                            
) REFERENCES AD_WF_RESPONSIBLE (                                                
AD_WF_RESPONSIBLE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOW ADD                                                     
CONSTRAINT ADWORKFLOWPROCESSOR_ADWF                                             
FOREIGN KEY (                                                                   
AD_WORKFLOWPROCESSOR_ID                                                         
) REFERENCES AD_WORKFLOWPROCESSOR (                                             
AD_WORKFLOWPROCESSOR_ID                                                         
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOW ADD                                                     
CONSTRAINT WORKFLOWCLIENT                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOWPROCESSOR ADD                                            
CONSTRAINT ADUSER_ADWORKFLOWPROCESSOR                                           
FOREIGN KEY (                                                                   
SUPERVISOR_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOWPROCESSORLOG ADD                                         
CONSTRAINT ADWORKFLOWPROCESSOR_LOG                                              
FOREIGN KEY (                                                                   
AD_WORKFLOWPROCESSOR_ID                                                         
) REFERENCES AD_WORKFLOWPROCESSOR (                                             
AD_WORKFLOWPROCESSOR_ID                                                         
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WORKFLOW_ACCESS ADD                                              
CONSTRAINT ADWORKFOW_WORKFLOWACCESS                                             
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WORKFLOW_ACCESS ADD                                              
CONSTRAINT ADROLE_ADWORKFLOWACCESS                                              
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE AD_WORKFLOW_ACCESS ADD                                              
CONSTRAINT AD_WORKFLOWACCESS_CLIENT                                             
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOW_ACCESS ADD                                              
CONSTRAINT AD_WORKFLOWACCESS_ORG                                                
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOW_TRL ADD                                                 
CONSTRAINT AD_LANGUAGE_WORKFLOWTRL                                              
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE AD_WORKFLOW_TRL ADD                                                 
CONSTRAINT AD_WORKFLOWTRL                                                       
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT CLOCATION_AASSET                                                     
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT AASSETGROUP_AASSET                                                   
FOREIGN KEY (                                                                   
A_ASSET_GROUP_ID                                                                
) REFERENCES A_ASSET_GROUP (                                                    
A_ASSET_GROUP_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT MLOCATOR_AASSET                                                      
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT MATTRIBUTESETINSTANCE_AASSET                                         
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT CBPLOCATION_AASSET                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT ADUSER_AASSET                                                        
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT CBPARTNER_AASSET                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE A_ASSET ADD                                                         
CONSTRAINT MPRODUCT_AASSET                                                      
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_ACCT ADD                                                    
CONSTRAINT CACCTSCHEMA_AASSETACCT                                               
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_ACCT ADD                                                    
CONSTRAINT ADEPRECIATION_AASSETACCT                                             
FOREIGN KEY (                                                                   
A_DEPRECIATION_ID                                                               
) REFERENCES A_DEPRECIATION (                                                   
A_DEPRECIATION_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_ACCT ADD                                                    
CONSTRAINT AASSET_AASSETACCT                                                    
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_ADDITION ADD                                                
CONSTRAINT AASSET_AASSETADDITION                                                
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_ADDITION ADD                                                
CONSTRAINT CINVOICELINE_AASSETADDITION                                          
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_CHANGE ADD                                                  
CONSTRAINT AAADDITION_AACHANGE                                                  
FOREIGN KEY (                                                                   
A_ASSET_ADDITION_ID                                                             
) REFERENCES A_ASSET_ADDITION (                                                 
A_ASSET_ADDITION_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_CHANGE ADD                                                  
CONSTRAINT AASSET_AASSETCHANGE                                                  
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_CHANGE ADD                                                  
CONSTRAINT AARETIREMENT_AACHANGE                                                
FOREIGN KEY (                                                                   
A_ASSET_RETIREMENT_ID                                                           
) REFERENCES A_ASSET_RETIREMENT (                                               
A_ASSET_RETIREMENT_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_CHANGE_AMT ADD                                              
CONSTRAINT AASSETCHANGE_AASSETCHANGEAMT                                         
FOREIGN KEY (                                                                   
A_ASSET_CHANGE_ID                                                               
) REFERENCES A_ASSET_CHANGE (                                                   
A_ASSET_CHANGE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_CHANGE_AMT ADD                                              
CONSTRAINT CACCTSCHEMA_AASSETCHANGEAMT                                          
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_DELIVERY ADD                                                
CONSTRAINT MOUTLINE_AASSETDELIVERY                                              
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE A_ASSET_DELIVERY ADD                                                
CONSTRAINT MPRODUCTDL_AASSETDELIVERY                                            
FOREIGN KEY (                                                                   
M_PRODUCTDOWNLOAD_ID                                                            
) REFERENCES M_PRODUCTDOWNLOAD (                                                
M_PRODUCTDOWNLOAD_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_DELIVERY ADD                                                
CONSTRAINT ADUSER_AASSETDELIVERY                                                
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_DELIVERY ADD                                                
CONSTRAINT AASSET_AASSETDELIVERY                                                
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_GROUP_ACCT ADD                                              
CONSTRAINT AASSETGROUP_AASSETGROUPACCT                                          
FOREIGN KEY (                                                                   
A_ASSET_GROUP_ID                                                                
) REFERENCES A_ASSET_GROUP (                                                    
A_ASSET_GROUP_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_GROUP_ACCT ADD                                              
CONSTRAINT CACCTSCHEMA_AASSETGROUPACCT                                          
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_GROUP_ACCT ADD                                              
CONSTRAINT ADEPRECIATION_AASSETGROUPACCT                                        
FOREIGN KEY (                                                                   
A_DEPRECIATION_ID                                                               
) REFERENCES A_DEPRECIATION (                                                   
A_DEPRECIATION_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_RETIREMENT ADD                                              
CONSTRAINT AASSET_AASSETRETIREMENT                                              
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_RETIREMENT ADD                                              
CONSTRAINT CINVOICELINE_AASSETRETIREMENT                                        
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE A_ASSET_USE ADD                                                     
CONSTRAINT AASSET_AASSETUSE                                                     
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATION ADD                                                  
CONSTRAINT MPRODUCT_AREGISTRATION                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATION ADD                                                  
CONSTRAINT ADUSER_AREGISTRATION                                                 
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATION ADD                                                  
CONSTRAINT AASSET_AREGISTRATION                                                 
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATION ADD                                                  
CONSTRAINT CBPARTNER_AREGISTRATION                                              
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATIONATTRIBUTE ADD                                         
CONSTRAINT ADREFERENCE_AREGATTRIBUTE                                            
FOREIGN KEY (                                                                   
AD_REFERENCE_ID                                                                 
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATIONATTRIBUTE ADD                                         
CONSTRAINT ADREFERENCEVALUE_AREGATTRIBUTE                                       
FOREIGN KEY (                                                                   
AD_REFERENCE_VALUE_ID                                                           
) REFERENCES AD_REFERENCE (                                                     
AD_REFERENCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATIONPRODUCT ADD                                           
CONSTRAINT AREGATTRIBUTE_AREGPRODUCT                                            
FOREIGN KEY (                                                                   
A_REGISTRATIONATTRIBUTE_ID                                                      
) REFERENCES A_REGISTRATIONATTRIBUTE (                                          
A_REGISTRATIONATTRIBUTE_ID                                                      
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATIONPRODUCT ADD                                           
CONSTRAINT MPRODUCT_AREGPRODUCT                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE A_REGISTRATIONVALUE ADD                                             
CONSTRAINT AREGISTRATION_AREGVALUE                                              
FOREIGN KEY (                                                                   
A_REGISTRATION_ID                                                               
) REFERENCES A_REGISTRATION (                                                   
A_REGISTRATION_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE A_REGISTRATIONVALUE ADD                                             
CONSTRAINT AREGATTRIBUTE_AREGVALUE                                              
FOREIGN KEY (                                                                   
A_REGISTRATIONATTRIBUTE_ID                                                      
) REFERENCES A_REGISTRATIONATTRIBUTE (                                          
A_REGISTRATIONATTRIBUTE_ID                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE B_BID ADD                                                           
CONSTRAINT BTOPIC_BBID                                                          
FOREIGN KEY (                                                                   
B_TOPIC_ID                                                                      
) REFERENCES B_TOPIC (                                                          
B_TOPIC_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_BID ADD                                                           
CONSTRAINT BBUYERFUNDS_BBID                                                     
FOREIGN KEY (                                                                   
B_BUYERFUNDS_ID                                                                 
) REFERENCES B_BUYERFUNDS (                                                     
B_BUYERFUNDS_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE B_BID ADD                                                           
CONSTRAINT BBUYER_BBID                                                          
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES B_BUYER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_BIDCOMMENT ADD                                                    
CONSTRAINT BTOPIC_BBIDCOMMENT                                                   
FOREIGN KEY (                                                                   
B_TOPIC_ID                                                                      
) REFERENCES B_TOPIC (                                                          
B_TOPIC_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_BIDCOMMENT ADD                                                    
CONSTRAINT ADUSER_BIDCOMMENT                                                    
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_BUYER ADD                                                         
CONSTRAINT ADUSER_BBUYER                                                        
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_BUYERFUNDS ADD                                                    
CONSTRAINT CPAYMENT_BBUYERFUNDS                                                 
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE B_BUYERFUNDS ADD                                                    
CONSTRAINT BBUYER_BBUYERFUNDS                                                   
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES B_BUYER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_BUYERFUNDS ADD                                                    
CONSTRAINT CORDER_BBUYERSFUNDS                                                  
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_OFFER ADD                                                         
CONSTRAINT BSELLERFUNDS_BOFFER                                                  
FOREIGN KEY (                                                                   
B_SELLERFUNDS_ID                                                                
) REFERENCES B_SELLERFUNDS (                                                    
B_SELLERFUNDS_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE B_OFFER ADD                                                         
CONSTRAINT BSELLER_BOFFER                                                       
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES B_SELLER (                                                         
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_OFFER ADD                                                         
CONSTRAINT BTOPIC_BOFFER                                                        
FOREIGN KEY (                                                                   
B_TOPIC_ID                                                                      
) REFERENCES B_TOPIC (                                                          
B_TOPIC_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_SELLER ADD                                                        
CONSTRAINT ADUSER_BSELLER                                                       
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_SELLERFUNDS ADD                                                   
CONSTRAINT CORDER_BSELLERFUNDS                                                  
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_SELLERFUNDS ADD                                                   
CONSTRAINT CPAYMENT_BSELLERFUNDS                                                
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE B_SELLERFUNDS ADD                                                   
CONSTRAINT BSELLER_BSELLERFUNDS                                                 
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES B_SELLER (                                                         
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE B_TOPIC ADD                                                         
CONSTRAINT BTOPICTYPE_BTOPIC                                                    
FOREIGN KEY (                                                                   
B_TOPICTYPE_ID                                                                  
) REFERENCES B_TOPICTYPE (                                                      
B_TOPICTYPE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE B_TOPIC ADD                                                         
CONSTRAINT BTOPICCATEGORY_BTOPIC                                                
FOREIGN KEY (                                                                   
B_TOPICCATEGORY_ID                                                              
) REFERENCES B_TOPICCATEGORY (                                                  
B_TOPICCATEGORY_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE B_TOPICCATEGORY ADD                                                 
CONSTRAINT BTOPICTYPE_BTOPICCATEGORY                                            
FOREIGN KEY (                                                                   
B_TOPICTYPE_ID                                                                  
) REFERENCES B_TOPICTYPE (                                                      
B_TOPICTYPE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE B_TOPICTYPE ADD                                                     
CONSTRAINT MPRICELIST_BTOPICTYPE                                                
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE B_TOPICTYPE ADD                                                     
CONSTRAINT MPRODUCT_BTOPICTYPEMEMBER                                            
FOREIGN KEY (                                                                   
M_PRODUCTMEMBER_ID                                                              
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE B_TOPICTYPE ADD                                                     
CONSTRAINT MPRODUCT_BTOPICTYPE                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ACCTPROCESSOR ADD                                                 
CONSTRAINT ADUSER_CACCTPROCESSOR                                                
FOREIGN KEY (                                                                   
SUPERVISOR_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ACCTPROCESSORLOG ADD                                              
CONSTRAINT CACCTPROCESSOR_LOG                                                   
FOREIGN KEY (                                                                   
C_ACCTPROCESSOR_ID                                                              
) REFERENCES C_ACCTPROCESSOR (                                                  
C_ACCTPROCESSOR_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_ACCTSCHEMA ADD                                                    
CONSTRAINT MCOSTTYPE_CACCTSCHEMA                                                
FOREIGN KEY (                                                                   
M_COSTTYPE_ID                                                                   
) REFERENCES M_COSTTYPE (                                                       
M_COSTTYPE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA ADD                                                    
CONSTRAINT C_CURRENCY_C_ACCTSCHEMA                                              
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA ADD                                                    
CONSTRAINT CPERIOD_CACCTSCHEMA                                                  
FOREIGN KEY (                                                                   
C_PERIOD_ID                                                                     
) REFERENCES C_PERIOD (                                                         
C_PERIOD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA ADD                                                    
CONSTRAINT AD_CLIENT_C_ACCTSCHEMA                                               
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA ADD                                                    
CONSTRAINT AD_ORG_C_ACCTSCHEMA                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PAYDISCOUNTEXP_CSCHEMADEFAU                                       
FOREIGN KEY (                                                                   
PAYDISCOUNT_EXP_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BSETTLEMENTLOSS_CSCHEMADEFA                                       
FOREIGN KEY (                                                                   
B_SETTLEMENTLOSS_ACCT                                                           
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BINTERESTEXP_CSCHEMADEFAULT                                       
FOREIGN KEY (                                                                   
B_INTERESTEXP_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CRECEIVABLE_CSCHEMADEFAULT                                        
FOREIGN KEY (                                                                   
C_RECEIVABLE_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_TDUE_CSCHEMADEFAULT                                               
FOREIGN KEY (                                                                   
T_DUE_ACCT                                                                      
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PTDISCOUNTREC_CSCHEMADEFAUL                                       
FOREIGN KEY (                                                                   
P_TRADEDISCOUNTREC_ACCT                                                         
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_WITHHOLDING_CSCHEMADEFAULT                                        
FOREIGN KEY (                                                                   
WITHHOLDING_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CBCASHTRANSFER_CSCHEMADEFAU                                       
FOREIGN KEY (                                                                   
CB_CASHTRANSFER_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CBEXPENSE_CSCHEMADEFAULT                                          
FOREIGN KEY (                                                                   
CB_EXPENSE_ACCT                                                                 
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CHEXPENSE_CSCHEMADEFAULT                                          
FOREIGN KEY (                                                                   
CH_EXPENSE_ACCT                                                                 
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CHREVENUE_CSCHEMADEFAULT                                          
FOREIGN KEY (                                                                   
CH_REVENUE_ACCT                                                                 
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_EEXPENSE_CSCHEMADEFAULT                                           
FOREIGN KEY (                                                                   
E_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_EPREPAYMENT_CSCHEMADEFAULT                                        
FOREIGN KEY (                                                                   
E_PREPAYMENT_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_UNEARNEDREVENUE_CSCHEMADEFA                                       
FOREIGN KEY (                                                                   
UNEARNEDREVENUE_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CPREPAYMENT_CSCHEMADEFAULT                                        
FOREIGN KEY (                                                                   
C_PREPAYMENT_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_REALIZEDGAIN_CSCHEMADEFAULT                                       
FOREIGN KEY (                                                                   
REALIZEDGAIN_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PTDISCOUNTGRANT_CSCHEMADEFA                                       
FOREIGN KEY (                                                                   
P_TRADEDISCOUNTGRANT_ACCT                                                       
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_NOTINVOICEDRECEIPTS_CSCHEMA                                       
FOREIGN KEY (                                                                   
NOTINVOICEDRECEIPTS_ACCT                                                        
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PASSET_CSCHEMADEFAULT                                             
FOREIGN KEY (                                                                   
P_ASSET_ACCT                                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PAYDISCOUNTREV_CSCHEMADEFAU                                       
FOREIGN KEY (                                                                   
PAYDISCOUNT_REV_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PCOGS_CSCHEMADEFAULT                                              
FOREIGN KEY (                                                                   
P_COGS_ACCT                                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_WREVALUATION_CSCHEMADEFAULT                                       
FOREIGN KEY (                                                                   
W_REVALUATION_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_WRITEOFF_CSCHEMADEFAULT                                           
FOREIGN KEY (                                                                   
WRITEOFF_ACCT                                                                   
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT CACCTSCHEMA_DEFAULT                                                  
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BASSET_CSCHEMADEFAULT                                             
FOREIGN KEY (                                                                   
B_ASSET_ACCT                                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BEXPENSE_CSCHEMADEFAULT                                           
FOREIGN KEY (                                                                   
B_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BINTRANSIT_CSCHEMADEFAULT                                         
FOREIGN KEY (                                                                   
B_INTRANSIT_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BREVALUATIONGAIN_CSCHEMADEF                                       
FOREIGN KEY (                                                                   
B_REVALUATIONGAIN_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BREVALUATIONLOSS_CSCHEMADEF                                       
FOREIGN KEY (                                                                   
B_REVALUATIONLOSS_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BSETTLEMENTGAIN_CSCHEMADEFA                                       
FOREIGN KEY (                                                                   
B_SETTLEMENTGAIN_ACCT                                                           
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BUNALLOCATEDCASH_CSCHEMADEF                                       
FOREIGN KEY (                                                                   
B_UNALLOCATEDCASH_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BUNIDENTIFIED_CSCHEMADEFAUL                                       
FOREIGN KEY (                                                                   
B_UNIDENTIFIED_ACCT                                                             
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CBASSET_CSCHEMADEFAULT                                            
FOREIGN KEY (                                                                   
CB_ASSET_ACCT                                                                   
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BPAYMENTSELECT_CSCHEMADEFAU                                       
FOREIGN KEY (                                                                   
B_PAYMENTSELECT_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_UNREALIZEDGAIN_CSCHEMADEFAU                                       
FOREIGN KEY (                                                                   
UNREALIZEDGAIN_ACCT                                                             
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PINVOICEPV_CSCHEMADEFAULT                                         
FOREIGN KEY (                                                                   
P_INVOICEPRICEVARIANCE_ACCT                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PJASSET_CSCHEMADEFAULT                                            
FOREIGN KEY (                                                                   
PJ_ASSET_ACCT                                                                   
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PJWIP_CSCHEMADEFAULT                                              
FOREIGN KEY (                                                                   
PJ_WIP_ACCT                                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PPURCHASEPV_CSCHEMADEFAULT                                        
FOREIGN KEY (                                                                   
P_PURCHASEPRICEVARIANCE_ACCT                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PREVENUE_CSCHEMADEFAULT                                           
FOREIGN KEY (                                                                   
P_REVENUE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_TEXPENSE_CSCHEMADEFAULT                                           
FOREIGN KEY (                                                                   
T_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_TLIABILITY_CSCHEMADEFAULT                                         
FOREIGN KEY (                                                                   
T_LIABILITY_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_TREC_CSCHEMADEFAULT                                               
FOREIGN KEY (                                                                   
T_RECEIVABLES_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_UNREALIZEDLOSS_CSCHEMADEFAU                                       
FOREIGN KEY (                                                                   
UNREALIZEDLOSS_ACCT                                                             
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_VLIABILITYSERVICES_CSCHEMAD                                       
FOREIGN KEY (                                                                   
V_LIABILITY_SERVICES_ACCT                                                       
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_VPREPAYMENT_CSCHEMADEFAULT                                        
FOREIGN KEY (                                                                   
V_PREPAYMENT_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_WDIFFERENCES_CSCHEMADEFAULT                                       
FOREIGN KEY (                                                                   
W_DIFFERENCES_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_WINVACTUALADJUST_CSCHEMADEF                                       
FOREIGN KEY (                                                                   
W_INVACTUALADJUST_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_WINVENTORY_CSCHEMADEFAULT                                         
FOREIGN KEY (                                                                   
W_INVENTORY_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_REALIZEDLOSS_CSCHEMADEFAULT                                       
FOREIGN KEY (                                                                   
REALIZEDLOSS_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_TCREDIT_CSCHEMADEFAULT                                            
FOREIGN KEY (                                                                   
T_CREDIT_ACCT                                                                   
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_PEXPENSE_CSCHEMADEFAULT                                           
FOREIGN KEY (                                                                   
P_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_VLIABILITY_CSCHEMADEFAULT                                         
FOREIGN KEY (                                                                   
V_LIABILITY_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_NOTINVOICEDREC_CSCHEMADEFAU                                       
FOREIGN KEY (                                                                   
NOTINVOICEDRECEIVABLES_ACCT                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CBDIFFERENCES_CSCHEMADEFAUL                                       
FOREIGN KEY (                                                                   
CB_DIFFERENCES_ACCT                                                             
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_NOTINVOICEDREVENUE_CSCHEMAD                                       
FOREIGN KEY (                                                                   
NOTINVOICEDREVENUE_ACCT                                                         
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_CBRECEIPT_CSCHEMADEFAULT                                          
FOREIGN KEY (                                                                   
CB_RECEIPT_ACCT                                                                 
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_DEFAULT ADD                                            
CONSTRAINT VC_BINTERESTREV_CSCHEMADEFAULT                                       
FOREIGN KEY (                                                                   
B_INTERESTREV_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT CBUSPARTNER_CASCHEMAELEMENT                                          
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT CSALESREGION_CASCHEMAELEMENT                                         
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT SOCAMPAIGN_CASCHEMAELEMENT                                           
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT CELEMENT_CASCHEMAELEMENT                                             
FOREIGN KEY (                                                                   
C_ELEMENT_ID                                                                    
) REFERENCES C_ELEMENT (                                                        
C_ELEMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT CLOCATION_CASCHEMAELEMENT                                            
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT MPRODUCT_CASCHEMAELEMENT                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT CPROJECT_CASCHEMAELEMENT                                             
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT CACTIVITY_CACCTSCHEMAELEMENT                                         
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT CELEMENTVALUE_CASCHEMAELEMENT                                        
FOREIGN KEY (                                                                   
C_ELEMENTVALUE_ID                                                               
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT ADCLIENT_CASCHEMAELEMENT                                             
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT ADORGID_C_ASCHEMAELEMENT                                             
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT ADORG_CASCHEMAELEMENT                                                
FOREIGN KEY (                                                                   
ORG_ID                                                                          
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_ELEMENT ADD                                            
CONSTRAINT CACCTSCHEMA_CASCHEMAELEMENT                                          
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT VC_SUSPENSEBALANCING_CSCHEMAGL                                       
FOREIGN KEY (                                                                   
SUSPENSEBALANCING_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT VC_INCOMESUMMARY_CSCHEMAGL                                           
FOREIGN KEY (                                                                   
INCOMESUMMARY_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT VC_CURRENCYBALANCING_CSCHEMAGL                                       
FOREIGN KEY (                                                                   
CURRENCYBALANCING_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT VC_INTERCOMPANYDUETO_CSCHEMAGL                                       
FOREIGN KEY (                                                                   
INTERCOMPANYDUETO_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT VC_INTERCOMPANYDUEFROM_CSCHEMA                                       
FOREIGN KEY (                                                                   
INTERCOMPANYDUEFROM_ACCT                                                        
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT VC_PPVOFFSET_CSCHEMAGL                                               
FOREIGN KEY (                                                                   
PPVOFFSET_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT VC_RETAINEDEARNING_CSCHEMAGL                                         
FOREIGN KEY (                                                                   
RETAINEDEARNING_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT VC_SUSPENSEERROR_CSCHEMAGL                                           
FOREIGN KEY (                                                                   
SUSPENSEERROR_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_ACCTSCHEMA_GL ADD                                                 
CONSTRAINT CACCTSCHEMA_CACCTSCHEMAGL                                            
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_ALLOCATIONHDR ADD                                                 
CONSTRAINT CCURRENCY_CALLOCATION                                                
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ALLOCATIONLINE ADD                                                
CONSTRAINT CALLOCATION_CALLOCATIONLINE                                          
FOREIGN KEY (                                                                   
C_ALLOCATIONHDR_ID                                                              
) REFERENCES C_ALLOCATIONHDR (                                                  
C_ALLOCATIONHDR_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE C_ALLOCATIONLINE ADD                                                
CONSTRAINT CINVOICE_CALLOCATIONLINE                                             
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ALLOCATIONLINE ADD                                                
CONSTRAINT CBPARTNER_CALLOCATIONLINE                                            
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ALLOCATIONLINE ADD                                                
CONSTRAINT CORDER_CALLOCATION                                                   
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ALLOCATIONLINE ADD                                                
CONSTRAINT CCASHLINE_CALLOCATIONLINE                                            
FOREIGN KEY (                                                                   
C_CASHLINE_ID                                                                   
) REFERENCES C_CASHLINE (                                                       
C_CASHLINE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ALLOCATIONLINE ADD                                                
CONSTRAINT CPAYMENT_CALLOCATIONLINE                                             
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_BANK ADD                                                          
CONSTRAINT CLOCATION_CBANK                                                      
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT ADD                                                   
CONSTRAINT CCURRENCY_CBANKACCOUNT                                               
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT ADD                                                   
CONSTRAINT CBANK_CBANKACCOUNT                                                   
FOREIGN KEY (                                                                   
C_BANK_ID                                                                       
) REFERENCES C_BANK (                                                           
C_BANK_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BANKACCOUNTDOC ADD                                                
CONSTRAINT CBANKACCOUNT_CBADOC                                                  
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BANKACCOUNTDOC ADD                                                
CONSTRAINT ADPRINTFORMAT_CBANKACCOUNTDOC                                        
FOREIGN KEY (                                                                   
CHECK_PRINTFORMAT_ID                                                            
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BASSET_CBANKACCOUNT                                               
FOREIGN KEY (                                                                   
B_ASSET_ACCT                                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BSETTLEMENTGAIN_CBANKACCOUN                                       
FOREIGN KEY (                                                                   
B_SETTLEMENTGAIN_ACCT                                                           
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BREVALUATIONGAIN_CBANKACCOU                                       
FOREIGN KEY (                                                                   
B_REVALUATIONGAIN_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT CACCTSCHEMA_CBANKACCOUNTACCT                                         
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BREVALUATIONLOSS_CBANKACCOU                                       
FOREIGN KEY (                                                                   
B_REVALUATIONLOSS_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BSETTLEMENTLOSS_CBANKACCOUN                                       
FOREIGN KEY (                                                                   
B_SETTLEMENTLOSS_ACCT                                                           
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BINTERESTREV_CBANKACCOUNT                                         
FOREIGN KEY (                                                                   
B_INTERESTREV_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT CBANKACCOUNT_CBANKACCTACCT                                           
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BEXPENSE_CBANKACCOUNT                                             
FOREIGN KEY (                                                                   
B_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BINTERESTEXP_CBANKACCOUNT                                         
FOREIGN KEY (                                                                   
B_INTERESTEXP_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BINTRANSIT_CBANKACCOUNT                                           
FOREIGN KEY (                                                                   
B_INTRANSIT_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BUNIDENTIFIED_CBANKACCOUNT                                        
FOREIGN KEY (                                                                   
B_UNIDENTIFIED_ACCT                                                             
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BPAYMENTSELECT_CBANKACCOUNT                                       
FOREIGN KEY (                                                                   
B_PAYMENTSELECT_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKACCOUNT_ACCT ADD                                              
CONSTRAINT VC_BUNALLOCATEDCASH_CBANKACCOU                                       
FOREIGN KEY (                                                                   
B_UNALLOCATEDCASH_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BANKSTATEMENT ADD                                                 
CONSTRAINT CBANKACCOUNT_CBANKSTATEMENT                                          
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_BANKSTATEMENTLINE ADD                                             
CONSTRAINT CINVOICE_CBANKSTATEMENTLINE                                          
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_BANKSTATEMENTLINE ADD                                             
CONSTRAINT CCURRENCY_CBANKSTMTLINE                                              
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BANKSTATEMENTLINE ADD                                             
CONSTRAINT CCHARGE_CBANKSTMTLIME                                                
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_BANKSTATEMENTLINE ADD                                             
CONSTRAINT CBPARTNER_CBANKSTATEMENTLINE                                         
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BANKSTATEMENTLINE ADD                                             
CONSTRAINT CBSTATEMENT_CBSTATEMENTLINE                                          
FOREIGN KEY (                                                                   
C_BANKSTATEMENT_ID                                                              
) REFERENCES C_BANKSTATEMENT (                                                  
C_BANKSTATEMENT_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BANKSTATEMENTLINE ADD                                             
CONSTRAINT CPAYMENT_CBANKSTMTLINE                                               
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_BANKSTATEMENTLOADER ADD                                           
CONSTRAINT CBANKACCT_CBANKSTMTLOADER                                            
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT AD_LANGUAGE_C_BUSPARTNER                                             
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT MDISCOUNTSPO_CBPARTNER                                               
FOREIGN KEY (                                                                   
PO_DISCOUNTSCHEMA_ID                                                            
) REFERENCES M_DISCOUNTSCHEMA (                                                 
M_DISCOUNTSCHEMA_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT CPAYMENTTERM_CBPARTNER                                               
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT CGREETING_CBPARTNER                                                  
FOREIGN KEY (                                                                   
C_GREETING_ID                                                                   
) REFERENCES C_GREETING (                                                       
C_GREETING_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT ADCLIENT_CBPARTNER                                                   
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT ADORG_CBPARTNER                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT ADORG_CBPARTNERORG                                                   
FOREIGN KEY (                                                                   
AD_ORGBP_ID                                                                     
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT ADPRINTFORMATINV_CBPARTNER                                           
FOREIGN KEY (                                                                   
INVOICE_PRINTFORMAT_ID                                                          
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT ADUSERSALESREP_CBPARTNER                                             
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT MPRICELIST_CBPARTNER                                                 
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT CBPARTNER_CPBARTNERPARENT                                            
FOREIGN KEY (                                                                   
BPARTNER_PARENT_ID                                                              
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT CBPGROUP_CBPARTNER                                                   
FOREIGN KEY (                                                                   
C_BP_GROUP_ID                                                                   
) REFERENCES C_BP_GROUP (                                                       
C_BP_GROUP_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT CDUNNING_CBPARTNER                                                   
FOREIGN KEY (                                                                   
C_DUNNING_ID                                                                    
) REFERENCES C_DUNNING (                                                        
C_DUNNING_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT CINVOICESCHEDULE_CBPARTNER                                           
FOREIGN KEY (                                                                   
C_INVOICESCHEDULE_ID                                                            
) REFERENCES C_INVOICESCHEDULE (                                                
C_INVOICESCHEDULE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT MDISCOUNTS_CBPARTNER                                                 
FOREIGN KEY (                                                                   
M_DISCOUNTSCHEMA_ID                                                             
) REFERENCES M_DISCOUNTSCHEMA (                                                 
M_DISCOUNTSCHEMA_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT CPOPAYMENTTERM_CBPARTNER                                             
FOREIGN KEY (                                                                   
PO_PAYMENTTERM_ID                                                               
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER ADD                                                      
CONSTRAINT MPRICELISTPO_CBUSPARTNER                                             
FOREIGN KEY (                                                                   
PO_PRICELIST_ID                                                                 
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER_LOCATION ADD                                             
CONSTRAINT CSALESREGION_BPARTNERLOCATION                                        
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER_LOCATION ADD                                             
CONSTRAINT C_BUSPARTNER_LOCATIONCLIENT                                          
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER_LOCATION ADD                                             
CONSTRAINT CLOCATION_CBPLOCATION                                                
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER_LOCATION ADD                                             
CONSTRAINT CBPARTNER_CBPLOCATION                                                
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BPARTNER_LOCATION ADD                                             
CONSTRAINT C_BUSPARTNER_LOCATIONORG                                             
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_BPARTNER_PRODUCT ADD                                              
CONSTRAINT CBPARTNER_CBPPRODUCT                                                 
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BPARTNER_PRODUCT ADD                                              
CONSTRAINT MPRODUCT_CBPPRODUCT                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_BANKACCOUNT ADD                                                
CONSTRAINT CBANK_CBPBANKACCOUNT                                                 
FOREIGN KEY (                                                                   
C_BANK_ID                                                                       
) REFERENCES C_BANK (                                                           
C_BANK_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_BP_BANKACCOUNT ADD                                                
CONSTRAINT CBPARTNER_CBPBANKACCOUNT                                             
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_BANKACCOUNT ADD                                                
CONSTRAINT ADUSER_CBPBANKACCOUNT                                                
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_BP_CUSTOMER_ACCT ADD                                              
CONSTRAINT CBUSPARTNER_CBPCUSTOMER_ACCT                                         
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_CUSTOMER_ACCT ADD                                              
CONSTRAINT VC_CRECEIVABLE_CBPCUSTOMER                                           
FOREIGN KEY (                                                                   
C_RECEIVABLE_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_CUSTOMER_ACCT ADD                                              
CONSTRAINT CACCTSCHEMA_CBPCUSTOMERACCT                                          
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_CUSTOMER_ACCT ADD                                              
CONSTRAINT VC_CPREPAYMENT_CBPCUSTOMER                                           
FOREIGN KEY (                                                                   
C_PREPAYMENT_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_EDI ADD                                                        
CONSTRAINT MWAREHOUSE_CBPEDI                                                    
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_BP_EDI ADD                                                        
CONSTRAINT ADSEQUENCE_CBPEDI                                                    
FOREIGN KEY (                                                                   
AD_SEQUENCE_ID                                                                  
) REFERENCES AD_SEQUENCE (                                                      
AD_SEQUENCE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_BP_EDI ADD                                                        
CONSTRAINT C_BPARTNER_CBPEDI                                                    
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BP_EMPLOYEE_ACCT ADD                                              
CONSTRAINT VC_EPREPAYMENT_CBPEMPLOYEE                                           
FOREIGN KEY (                                                                   
E_PREPAYMENT_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_EMPLOYEE_ACCT ADD                                              
CONSTRAINT CBUSPARTNER_C_BPEMPLOYEEACCT                                         
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_EMPLOYEE_ACCT ADD                                              
CONSTRAINT VC_EEXPENSE_CBPEMPLOYEE                                              
FOREIGN KEY (                                                                   
E_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_EMPLOYEE_ACCT ADD                                              
CONSTRAINT CACCTSCHEMA_CBPEMPLOYEEACCT                                          
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT CBPGROUP_CBPGROUPACCT                                                
FOREIGN KEY (                                                                   
C_BP_GROUP_ID                                                                   
) REFERENCES C_BP_GROUP (                                                       
C_BP_GROUP_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_NOTINVOICEDREVENUE_CBPGROUP                                       
FOREIGN KEY (                                                                   
NOTINVOICEDREVENUE_ACCT                                                         
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_PAYDISCOUNTREV_CBPGROUP                                           
FOREIGN KEY (                                                                   
PAYDISCOUNT_REV_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_NOTINVOICEDRECEIPTS_CBPGROU                                       
FOREIGN KEY (                                                                   
NOTINVOICEDRECEIPTS_ACCT                                                        
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_UNEARNEDREVENUE_CBPGROUP                                          
FOREIGN KEY (                                                                   
UNEARNEDREVENUE_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_CRECEIVABLE_CBPGROUP                                              
FOREIGN KEY (                                                                   
C_RECEIVABLE_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_CPREPAYMENT_CBPGROUP                                              
FOREIGN KEY (                                                                   
C_PREPAYMENT_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT CACCTSCHEMA_CBPGROUPACCT                                             
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_WRITEOFF_CBPGROUP                                                 
FOREIGN KEY (                                                                   
WRITEOFF_ACCT                                                                   
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_VPREPAYMENT_CBPGROUP                                              
FOREIGN KEY (                                                                   
V_PREPAYMENT_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_VLIABILITY_CBPGROUP                                               
FOREIGN KEY (                                                                   
V_LIABILITY_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_PAYDISCOUNTEXP_CBPGROUP                                           
FOREIGN KEY (                                                                   
PAYDISCOUNT_EXP_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_NOTINVOICEDREC_CBPGROUP                                           
FOREIGN KEY (                                                                   
NOTINVOICEDRECEIVABLES_ACCT                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_GROUP_ACCT ADD                                                 
CONSTRAINT VC_VLIABILITYSERVICES_CBPGROUP                                       
FOREIGN KEY (                                                                   
V_LIABILITY_SERVICES_ACCT                                                       
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_RELATION ADD                                                   
CONSTRAINT CBPLOCATION_CBPRELATION                                              
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_BP_RELATION ADD                                                   
CONSTRAINT CBPLOCATION_CBPRELATIONBP                                            
FOREIGN KEY (                                                                   
C_BPARTNERRELATION_LOCATION_ID                                                  
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_BP_RELATION ADD                                                   
CONSTRAINT CBPARTNER_CBPRELATION                                                
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BP_RELATION ADD                                                   
CONSTRAINT CBPARTNER_CBPRELATIONBP                                              
FOREIGN KEY (                                                                   
C_BPARTNERRELATION_ID                                                           
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_BP_VENDOR_ACCT ADD                                                
CONSTRAINT VC_VPREPAYMENT_CBPVENDOR                                             
FOREIGN KEY (                                                                   
V_PREPAYMENT_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_VENDOR_ACCT ADD                                                
CONSTRAINT CACCTSCHEMA_CBPVENDORACCT                                            
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_VENDOR_ACCT ADD                                                
CONSTRAINT VC_VLIABILITYSERVICES_CBPVENDO                                       
FOREIGN KEY (                                                                   
V_LIABILITY_SERVICES_ACCT                                                       
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_VENDOR_ACCT ADD                                                
CONSTRAINT VC_VLIABILITY_CBPVENDOR                                              
FOREIGN KEY (                                                                   
V_LIABILITY_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_BP_VENDOR_ACCT ADD                                                
CONSTRAINT C_BUSPARTNER_C_BP_VENDOR_ACCT                                        
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_WITHHOLDING ADD                                                
CONSTRAINT CBPARTNER_CBPWITHHOLDING                                             
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_BP_WITHHOLDING ADD                                                
CONSTRAINT CWITHHOLDING_CBPWITHHOLDING                                          
FOREIGN KEY (                                                                   
C_WITHHOLDING_ID                                                                
) REFERENCES C_WITHHOLDING (                                                    
C_WITHHOLDING_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_CALENDAR ADD                                                      
CONSTRAINT C_CALENDARCLIENT                                                     
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_CALENDAR ADD                                                      
CONSTRAINT C_CALENDARORG                                                        
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_CAMPAIGN ADD                                                      
CONSTRAINT CCHANNEL_CCAMPAIGN                                                   
FOREIGN KEY (                                                                   
C_CHANNEL_ID                                                                    
) REFERENCES C_CHANNEL (                                                        
C_CHANNEL_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT CCAMPAIGN_CCASH                                                      
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT CELEMENTVALUEUSER1_CCASH                                             
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT CCASHBOOK_CCASH                                                      
FOREIGN KEY (                                                                   
C_CASHBOOK_ID                                                                   
) REFERENCES C_CASHBOOK (                                                       
C_CASHBOOK_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT CELEMENTVALUEUSER2_CCASH                                             
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT ADORG_CCASH                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT CACTIVITY_CCASH                                                      
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT CPROJECT_CCASH                                                       
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_CASH ADD                                                          
CONSTRAINT ADORGTRX_CCASH                                                       
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_CASHBOOK ADD                                                      
CONSTRAINT CCURRENCY_CCASHBOOK                                                  
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_CASHBOOK_ACCT ADD                                                 
CONSTRAINT CCASHBOOK_CCASHBOOKACCT                                              
FOREIGN KEY (                                                                   
C_CASHBOOK_ID                                                                   
) REFERENCES C_CASHBOOK (                                                       
C_CASHBOOK_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CASHBOOK_ACCT ADD                                                 
CONSTRAINT VC_CBDIFFERENCES_CCASHBOOK                                           
FOREIGN KEY (                                                                   
CB_DIFFERENCES_ACCT                                                             
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CASHBOOK_ACCT ADD                                                 
CONSTRAINT VC_CBASSET_CCASHBOOK                                                 
FOREIGN KEY (                                                                   
CB_ASSET_ACCT                                                                   
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CASHBOOK_ACCT ADD                                                 
CONSTRAINT VC_CBEXPENSE_CCASHBOOK                                               
FOREIGN KEY (                                                                   
CB_EXPENSE_ACCT                                                                 
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CASHBOOK_ACCT ADD                                                 
CONSTRAINT VC_CBCASHTRANSFER_CCASHBOOK                                          
FOREIGN KEY (                                                                   
CB_CASHTRANSFER_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CASHBOOK_ACCT ADD                                                 
CONSTRAINT CACCTSCHEMA_CCASHBOOKACCT                                            
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CASHBOOK_ACCT ADD                                                 
CONSTRAINT VC_CBRECEIPT_CCASHBOOK                                               
FOREIGN KEY (                                                                   
CB_RECEIPT_ACCT                                                                 
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CASHLINE ADD                                                      
CONSTRAINT CCURRENCY_CCASHLINE                                                  
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_CASHLINE ADD                                                      
CONSTRAINT CINVOICE_CCASHLINE                                                   
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_CASHLINE ADD                                                      
CONSTRAINT CCASH_CCASHLINE                                                      
FOREIGN KEY (                                                                   
C_CASH_ID                                                                       
) REFERENCES C_CASH (                                                           
C_CASH_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CASHLINE ADD                                                      
CONSTRAINT CBANKACCT_CCASHLINE                                                  
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_CASHLINE ADD                                                      
CONSTRAINT CCHARGE_CCASHLINE                                                    
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_CHARGE ADD                                                        
CONSTRAINT CTAXCATEGORY_CCHARGE                                                 
FOREIGN KEY (                                                                   
C_TAXCATEGORY_ID                                                                
) REFERENCES C_TAXCATEGORY (                                                    
C_TAXCATEGORY_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_CHARGE_ACCT ADD                                                   
CONSTRAINT VC_CHEXPENSE_CCHARGE                                                 
FOREIGN KEY (                                                                   
CH_EXPENSE_ACCT                                                                 
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CHARGE_ACCT ADD                                                   
CONSTRAINT VC_CHREVENUE_CCHARGE                                                 
FOREIGN KEY (                                                                   
CH_REVENUE_ACCT                                                                 
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CHARGE_ACCT ADD                                                   
CONSTRAINT CCHRAGE_CCHARGEACCT                                                  
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_CHARGE_ACCT ADD                                                   
CONSTRAINT CACCTSCHEMA_CCHARGEACCT                                              
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CITY ADD                                                          
CONSTRAINT CCOUNTRY_CCITY                                                       
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_CITY ADD                                                          
CONSTRAINT C_CITYCLIENT                                                         
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_CITY ADD                                                          
CONSTRAINT CREGION_CCITY                                                        
FOREIGN KEY (                                                                   
C_REGION_ID                                                                     
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_CITY ADD                                                          
CONSTRAINT C_CITYORG                                                            
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSION ADD                                                    
CONSTRAINT CCURRENCY_CCOMMISSION                                                
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSION ADD                                                    
CONSTRAINT CCHARGE_CCOMMISSION                                                  
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSION ADD                                                    
CONSTRAINT CBPARTNER_CCOMMISSION                                                
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONAMT ADD                                                 
CONSTRAINT CCOMLINE_CCOMAMT                                                     
FOREIGN KEY (                                                                   
C_COMMISSIONLINE_ID                                                             
) REFERENCES C_COMMISSIONLINE (                                                 
C_COMMISSIONLINE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONAMT ADD                                                 
CONSTRAINT CCOMMENTRUN_CCOMMISSIONAMT                                           
FOREIGN KEY (                                                                   
C_COMMISSIONRUN_ID                                                              
) REFERENCES C_COMMISSIONRUN (                                                  
C_COMMISSIONRUN_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_COMMISSIONDETAIL ADD                                              
CONSTRAINT CORDERLINE_CCOMMISSIONDETAIL                                         
FOREIGN KEY (                                                                   
C_ORDERLINE_ID                                                                  
) REFERENCES C_ORDERLINE (                                                      
C_ORDERLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONDETAIL ADD                                              
CONSTRAINT CCURRENCY_CCOMMISSIONDETAIL                                          
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONDETAIL ADD                                              
CONSTRAINT CCOMMISSIONAMT_CCOMDETAIL                                            
FOREIGN KEY (                                                                   
C_COMMISSIONAMT_ID                                                              
) REFERENCES C_COMMISSIONAMT (                                                  
C_COMMISSIONAMT_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_COMMISSIONDETAIL ADD                                              
CONSTRAINT CINVOICELINE_CCOMMISSIONDET                                          
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONLINE ADD                                                
CONSTRAINT ADORGTRX_CCOMMISSIONLINE                                             
FOREIGN KEY (                                                                   
ORG_ID                                                                          
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONLINE ADD                                                
CONSTRAINT MPRODUCT_CCOMMISSIONLINE                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONLINE ADD                                                
CONSTRAINT CSALESREGION_CCOMMISSIONLINE                                         
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONLINE ADD                                                
CONSTRAINT MPRODUCTCAT_CCOMMISSIONLINE                                          
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONLINE ADD                                                
CONSTRAINT CBPGROUP_COMMISSIONLINE                                              
FOREIGN KEY (                                                                   
C_BP_GROUP_ID                                                                   
) REFERENCES C_BP_GROUP (                                                       
C_BP_GROUP_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONLINE ADD                                                
CONSTRAINT CBPARTNER_CCOMMISSIONLINE                                            
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_COMMISSIONLINE ADD                                                
CONSTRAINT CCOMMISSION_CCOMMISSIONLINE                                          
FOREIGN KEY (                                                                   
C_COMMISSION_ID                                                                 
) REFERENCES C_COMMISSION (                                                     
C_COMMISSION_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_COMMISSIONRUN ADD                                                 
CONSTRAINT CCOMMISSION_CCOMMISSIONRUN                                           
FOREIGN KEY (                                                                   
C_COMMISSION_ID                                                                 
) REFERENCES C_COMMISSION (                                                     
C_COMMISSION_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE C_CONVERSION_RATE ADD                                               
CONSTRAINT CCONVERSIONTYPE_CCONVRATE                                            
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_CONVERSION_RATE ADD                                               
CONSTRAINT C_CONVERSION_RATECLIENT                                              
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_CONVERSION_RATE ADD                                               
CONSTRAINT CCURRENCY_CCONVERSIONRATE                                            
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_CONVERSION_RATE ADD                                               
CONSTRAINT C_CONVERSION_RATEORG                                                 
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_CONVERSION_RATE ADD                                               
CONSTRAINT C_CURRENCYCONVRATETO                                                 
FOREIGN KEY (                                                                   
C_CURRENCY_ID_TO                                                                
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_COUNTRY ADD                                                       
CONSTRAINT C_COUNTRYCLIENT                                                      
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_COUNTRY ADD                                                       
CONSTRAINT CCURRENCY_CCOUNTRY                                                   
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_COUNTRY ADD                                                       
CONSTRAINT C_COUNTRYORG                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_COUNTRY ADD                                                       
CONSTRAINT ADLANGUAGE_CCOUNTRY                                                  
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_COUNTRY_TRL ADD                                                   
CONSTRAINT ADLANGUAGE_CCOUNTRYTRL                                               
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_COUNTRY_TRL ADD                                                   
CONSTRAINT CCOUNTRY_CCOUNTRYTRL                                                 
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CURRENCY ADD                                                      
CONSTRAINT C_CURRENCYCLIENT                                                     
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_CURRENCY ADD                                                      
CONSTRAINT C_CURRENCYORG                                                        
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_CURRENCY_ACCT ADD                                                 
CONSTRAINT VC_UNREALIZEDLOSS_CCURRENCY                                          
FOREIGN KEY (                                                                   
UNREALIZEDLOSS_ACCT                                                             
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CURRENCY_ACCT ADD                                                 
CONSTRAINT CACCTSCHEMA_CCURRENCYACCT                                            
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE C_CURRENCY_ACCT ADD                                                 
CONSTRAINT CCURRENCY_CCURRENCYACCT                                              
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_CURRENCY_ACCT ADD                                                 
CONSTRAINT VC_UNREALIZEDGAIN_CCURRENCY                                          
FOREIGN KEY (                                                                   
UNREALIZEDGAIN_ACCT                                                             
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CURRENCY_ACCT ADD                                                 
CONSTRAINT VC_REALIZEDGAIN_CCURRENCY                                            
FOREIGN KEY (                                                                   
REALIZEDGAIN_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CURRENCY_ACCT ADD                                                 
CONSTRAINT VC_REALIZEDLOSS_CCURRENCY                                            
FOREIGN KEY (                                                                   
REALIZEDLOSS_ACCT                                                               
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_CURRENCY_TRL ADD                                                  
CONSTRAINT ADLANGUAGE_CCURRENCYTRL                                              
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CURRENCY_TRL ADD                                                  
CONSTRAINT CCURRENCY_CCURRENCYTRL                                               
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CYCLE ADD                                                         
CONSTRAINT CCURRENCY_CCYCLE                                                     
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_CYCLEPHASE ADD                                                    
CONSTRAINT CPHASE_CCYCLEPHASE                                                   
FOREIGN KEY (                                                                   
C_PHASE_ID                                                                      
) REFERENCES C_PHASE (                                                          
C_PHASE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CYCLEPHASE ADD                                                    
CONSTRAINT CCYCLESTEP_CCYCLEPHASE                                               
FOREIGN KEY (                                                                   
C_CYCLESTEP_ID                                                                  
) REFERENCES C_CYCLESTEP (                                                      
C_CYCLESTEP_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_CYCLESTEP ADD                                                     
CONSTRAINT CCYCLE_CCYCLESTEP                                                    
FOREIGN KEY (                                                                   
C_CYCLE_ID                                                                      
) REFERENCES C_CYCLE (                                                          
C_CYCLE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_DOCTYPE ADD                                                       
CONSTRAINT GLCATEGORY_CDOCTYPE                                                  
FOREIGN KEY (                                                                   
GL_CATEGORY_ID                                                                  
) REFERENCES GL_CATEGORY (                                                      
GL_CATEGORY_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_DOCTYPE ADD                                                       
CONSTRAINT CDOCTYPE_PROFORMA                                                    
FOREIGN KEY (                                                                   
C_DOCTYPEPROFORMA_ID                                                            
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_DOCTYPE ADD                                                       
CONSTRAINT ADPRINTFORMAT_CDOCTYPE                                               
FOREIGN KEY (                                                                   
AD_PRINTFORMAT_ID                                                               
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_DOCTYPE ADD                                                       
CONSTRAINT CDOCTYPE_SHIPMENT                                                    
FOREIGN KEY (                                                                   
C_DOCTYPESHIPMENT_ID                                                            
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_DOCTYPE ADD                                                       
CONSTRAINT AD_SEQUENCE_DOCTYPEDOC                                               
FOREIGN KEY (                                                                   
DOCNOSEQUENCE_ID                                                                
) REFERENCES AD_SEQUENCE (                                                      
AD_SEQUENCE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_DOCTYPE ADD                                                       
CONSTRAINT CDOCTYPE_INVOICE                                                     
FOREIGN KEY (                                                                   
C_DOCTYPEINVOICE_ID                                                             
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_DOCTYPECOUNTER ADD                                                
CONSTRAINT CDOCTYPECOUNT_CDOCTYPECOUNT                                          
FOREIGN KEY (                                                                   
COUNTER_C_DOCTYPE_ID                                                            
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_DOCTYPECOUNTER ADD                                                
CONSTRAINT CDOCTYPE_CDOCTYPECOUNTER                                             
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_DOCTYPE_TRL ADD                                                   
CONSTRAINT CDOCTYPE_CDOCTYPETRL                                                 
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_DOCTYPE_TRL ADD                                                   
CONSTRAINT ADLANGUAGE_CDOCTYPETRL                                               
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGLEVEL ADD                                                  
CONSTRAINT CDUNNING_CDUNNINGLEVEL                                               
FOREIGN KEY (                                                                   
C_DUNNING_ID                                                                    
) REFERENCES C_DUNNING (                                                        
C_DUNNING_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGLEVEL ADD                                                  
CONSTRAINT ADPRINTFORMAT_CDUNNINGLEVEL                                          
FOREIGN KEY (                                                                   
DUNNING_PRINTFORMAT_ID                                                          
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGLEVEL_TRL ADD                                              
CONSTRAINT CDUNNINGLEVEL_CDLTRL                                                 
FOREIGN KEY (                                                                   
C_DUNNINGLEVEL_ID                                                               
) REFERENCES C_DUNNINGLEVEL (                                                   
C_DUNNINGLEVEL_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGLEVEL_TRL ADD                                              
CONSTRAINT ADLANGUAGE_CDUNNINGLEVEL                                             
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGRUN ADD                                                    
CONSTRAINT CDUNNINGLEVEL_CDUNNINGRUN                                            
FOREIGN KEY (                                                                   
C_DUNNINGLEVEL_ID                                                               
) REFERENCES C_DUNNINGLEVEL (                                                   
C_DUNNINGLEVEL_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGRUNENTRY ADD                                               
CONSTRAINT CCURRENCY_CDUNNINGRUNENTRY                                           
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGRUNENTRY ADD                                               
CONSTRAINT CDUNNINGRUN_CDUNNINGRUNENTRY                                         
FOREIGN KEY (                                                                   
C_DUNNINGRUN_ID                                                                 
) REFERENCES C_DUNNINGRUN (                                                     
C_DUNNINGRUN_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_DUNNINGRUNENTRY ADD                                               
CONSTRAINT CBPARTNER_CDUNNINGRUNENTRY                                           
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGRUNLINE ADD                                                
CONSTRAINT CINVOICE_CDUNNINGRUNLINE                                             
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_DUNNINGRUNLINE ADD                                                
CONSTRAINT CDUNNINGRUNENTRY_LINE                                                
FOREIGN KEY (                                                                   
C_DUNNINGRUNENTRY_ID                                                            
) REFERENCES C_DUNNINGRUNENTRY (                                                
C_DUNNINGRUNENTRY_ID                                                            
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_DUNNINGRUNLINE ADD                                                
CONSTRAINT CPAYMENT_CDUNNINGRUNLINE                                             
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENT ADD                                                       
CONSTRAINT ADTREE1_CELEMENT                                                     
FOREIGN KEY (                                                                   
ADD1TREE_ID                                                                     
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENT ADD                                                       
CONSTRAINT ADTREE_CELEMENT                                                      
FOREIGN KEY (                                                                   
AD_TREE_ID                                                                      
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENT ADD                                                       
CONSTRAINT C_ELEMENTORG                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENT ADD                                                       
CONSTRAINT ADCLIENT_CELEMENT                                                    
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENT ADD                                                       
CONSTRAINT ADTREE2_CELEMENT                                                     
FOREIGN KEY (                                                                   
ADD2TREE_ID                                                                     
) REFERENCES AD_TREE (                                                          
AD_TREE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENTVALUE ADD                                                  
CONSTRAINT CELEMENT_CELEMENTVALUE                                               
FOREIGN KEY (                                                                   
C_ELEMENT_ID                                                                    
) REFERENCES C_ELEMENT (                                                        
C_ELEMENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_ELEMENTVALUE ADD                                                  
CONSTRAINT CBANKACCOUNT_CELEMENTVALUE                                           
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENTVALUE ADD                                                  
CONSTRAINT ADORG_CELEMENTVALUE                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENTVALUE ADD                                                  
CONSTRAINT ADCLIENT_CELEMENTVALUE                                               
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENTVALUE ADD                                                  
CONSTRAINT CCURRENCY_CELEMENTVALUE                                              
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENTVALUE_TRL ADD                                              
CONSTRAINT ADLANGUAGE_CELEMENTVALUETRL                                          
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_ELEMENTVALUE_TRL ADD                                              
CONSTRAINT CELEMENTVALUE_CEVALUETRL                                             
FOREIGN KEY (                                                                   
C_ELEMENTVALUE_ID                                                               
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_GREETING_TRL ADD                                                  
CONSTRAINT ADLANGUAGE_CGREETINGTRL                                              
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_GREETING_TRL ADD                                                  
CONSTRAINT CGREETING_CGREETINGTRL                                               
FOREIGN KEY (                                                                   
C_GREETING_ID                                                                   
) REFERENCES C_GREETING (                                                       
C_GREETING_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INTERORG_ACCT ADD                                                 
CONSTRAINT CACCTSCHEMA_CINTERORGACCT                                            
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_INTERORG_ACCT ADD                                                 
CONSTRAINT VC_INTERCOMPANYDUEFROM_CINTERO                                       
FOREIGN KEY (                                                                   
INTERCOMPANYDUEFROM_ACCT                                                        
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_INTERORG_ACCT ADD                                                 
CONSTRAINT VC_INTERCOMPANYDUETO_CINTERORG                                       
FOREIGN KEY (                                                                   
INTERCOMPANYDUETO_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_INTERORG_ACCT ADD                                                 
CONSTRAINT ADORGTO_CINTERORGACCT                                                
FOREIGN KEY (                                                                   
AD_ORGTO_ID                                                                     
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_INTERORG_ACCT ADD                                                 
CONSTRAINT ADORG_CINTERORGACCT                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT ADUSER_SR_CINVOICE                                                   
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT ADUSER_CINVOICE                                                      
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CBPARTNER_CINVOICE                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT ADORGTRX_CINVOICE                                                    
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CCURRENCY_CINVOICE                                                   
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CDOCTYPETARGET_CINVOICE                                              
FOREIGN KEY (                                                                   
C_DOCTYPETARGET_ID                                                              
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CDOCTYPE_CINVOICE                                                    
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CELEMENTVALUEUSER1_CINVOICE                                          
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CINVOICE_REF                                                         
FOREIGN KEY (                                                                   
REF_INVOICE_ID                                                                  
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CPAYMENTTERM_CINVOICE                                                
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CPAYMENT_CINVOICE                                                    
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CPROJECT_CINVOICE                                                    
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT ADORG_CINVOICE                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CACTIVITY_CINVOICE                                                   
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT C_BPLOCATION_CINVOICE                                                
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT MPRICELIST_CINVOICE                                                  
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CORDER_CINVOICE                                                      
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CCAMPAIGN_CINVOICE                                                   
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CCHARGE_CINVOICE                                                     
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CCONVERSIONTYPE_CINVOICE                                             
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CCASHLINE_CINVOICE                                                   
FOREIGN KEY (                                                                   
C_CASHLINE_ID                                                                   
) REFERENCES C_CASHLINE (                                                       
C_CASHLINE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INVOICE ADD                                                       
CONSTRAINT CELEMENTVALUEUSER2_CINVOICE                                          
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCH ADD                                                  
CONSTRAINT ADUSER_CINVOICEBATCH                                                 
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCH ADD                                                  
CONSTRAINT CCURRENCY_CINVOICEBATCH                                              
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCH ADD                                                  
CONSTRAINT CCONVENTIONTYPE_CINVOICEBATCH                                        
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CACTIVITY_CINVOICEBATCHLINE                                          
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT ADORG_CINVOICEBATCHLINE                                              
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CBPLOCATION_CINVOICEBLINE                                            
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CDOCTYPE_CINVOICEBATCHLINE                                           
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CTAX_CINVOICEBATCHLINE                                               
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CPROJECT_CINVOICEBATCHLINE                                           
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CINVOICE_CINVOICEBATCHLINE                                           
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CINVOICELINE_CINVOICEBLINE                                           
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CINVOICEBATCH_CINVOICEBLINE                                          
FOREIGN KEY (                                                                   
C_INVOICEBATCH_ID                                                               
) REFERENCES C_INVOICEBATCH (                                                   
C_INVOICEBATCH_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CELEMENTVALUEU2_CINVOICEBLINE                                        
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CELEMENTVALUEU1_CINVOICEBLINE                                        
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CCHARGE_CINVOICEBATCHLINE                                            
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT ADUSER_CINVOICEBATCHLINE                                             
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT ADORGTRX_CINVOICEBATCHLINE                                           
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEBATCHLINE ADD                                              
CONSTRAINT CBPARTNER_CINVOICEBATCHLINE                                          
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT MPRODUCT_CINVOICELINE                                                
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT CORDERLINE_CINVOICELINE                                              
FOREIGN KEY (                                                                   
C_ORDERLINE_ID                                                                  
) REFERENCES C_ORDERLINE (                                                      
C_ORDERLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT CONVOICELINE_REF                                                     
FOREIGN KEY (                                                                   
REF_INVOICELINE_ID                                                              
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT CCHARGE_CINVOICELINE                                                 
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT CTAX_CINVOICELINE                                                    
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT CUOM_CINVOICELINE                                                    
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT MATTRSETINST_CINVOICELINE                                            
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT MINOUTLINE_CINVOICELINE                                              
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT SRESOURCEASSIGN_CINVOICELINE                                         
FOREIGN KEY (                                                                   
S_RESOURCEASSIGNMENT_ID                                                         
) REFERENCES S_RESOURCEASSIGNMENT (                                             
S_RESOURCEASSIGNMENT_ID                                                         
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT AASSET_CINVOICELINE                                                  
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_INVOICELINE ADD                                                   
CONSTRAINT CINVOICE_CINVOICELINE                                                
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_INVOICEPAYSCHEDULE ADD                                            
CONSTRAINT CPAYSCHEDULE_CINVOICEPAYSCHED                                        
FOREIGN KEY (                                                                   
C_PAYSCHEDULE_ID                                                                
) REFERENCES C_PAYSCHEDULE (                                                    
C_PAYSCHEDULE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_INVOICEPAYSCHEDULE ADD                                            
CONSTRAINT CINVOICE_CINVOICEPAYSCHED                                            
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_INVOICETAX ADD                                                    
CONSTRAINT CINVOICE_CINVOICETAX                                                 
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_INVOICETAX ADD                                                    
CONSTRAINT CTAX_CINVOICETAX                                                     
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_JOB ADD                                                           
CONSTRAINT CJOBCATEGORY_CJOB                                                    
FOREIGN KEY (                                                                   
C_JOBCATEGORY_ID                                                                
) REFERENCES C_JOBCATEGORY (                                                    
C_JOBCATEGORY_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_JOBASSIGNMENT ADD                                                 
CONSTRAINT ADUSER_CJOBASSIGNMENT                                                
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_JOBASSIGNMENT ADD                                                 
CONSTRAINT CJOB_CJOBASSIGNMENT                                                  
FOREIGN KEY (                                                                   
C_JOB_ID                                                                        
) REFERENCES C_JOB (                                                            
C_JOB_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_JOBREMUNERATION ADD                                               
CONSTRAINT CJOB_CJOBREMUNERATION                                                
FOREIGN KEY (                                                                   
C_JOB_ID                                                                        
) REFERENCES C_JOB (                                                            
C_JOB_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_JOBREMUNERATION ADD                                               
CONSTRAINT CREMUNERATION_CJOBREM                                                
FOREIGN KEY (                                                                   
C_REMUNERATION_ID                                                               
) REFERENCES C_REMUNERATION (                                                   
C_REMUNERATION_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_LANDEDCOST ADD                                                    
CONSTRAINT MINOUT_CLANDEDCOST                                                   
FOREIGN KEY (                                                                   
M_INOUT_ID                                                                      
) REFERENCES M_INOUT (                                                          
M_INOUT_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_LANDEDCOST ADD                                                    
CONSTRAINT MINOUTLINE_CLANDEDCOST                                               
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_LANDEDCOST ADD                                                    
CONSTRAINT MPRODUCT_CLANDEDCOST                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_LANDEDCOST ADD                                                    
CONSTRAINT CINVOICELINE_CLANDEDCOST                                             
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_LANDEDCOST ADD                                                    
CONSTRAINT CCOSTELEMENT_CLANDEDCOST                                             
FOREIGN KEY (                                                                   
M_COSTELEMENT_ID                                                                
) REFERENCES M_COSTELEMENT (                                                    
M_COSTELEMENT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_LANDEDCOSTALLOCATION ADD                                          
CONSTRAINT MPRODUCT_CLANDEDCOSTALLOC                                            
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_LANDEDCOSTALLOCATION ADD                                          
CONSTRAINT CLANDEDCOST_ALLOCATION                                               
FOREIGN KEY (                                                                   
C_LANDEDCOST_ID                                                                 
) REFERENCES C_LANDEDCOST (                                                     
C_LANDEDCOST_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_LOCATION ADD                                                      
CONSTRAINT CCITY_CLOCATION                                                      
FOREIGN KEY (                                                                   
C_CITY_ID                                                                       
) REFERENCES C_CITY (                                                           
C_CITY_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_LOCATION ADD                                                      
CONSTRAINT C_REGION_LOCATION                                                    
FOREIGN KEY (                                                                   
C_REGION_ID                                                                     
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_LOCATION ADD                                                      
CONSTRAINT C_COUNTRY_LOCATION                                                   
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_LOCATION ADD                                                      
CONSTRAINT ADORG_CLOCATION                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_LOCATION ADD                                                      
CONSTRAINT ADCLIENT_CLOCATION                                                   
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_NONBUSINESSDAY ADD                                                
CONSTRAINT C_NONBUSINESDAYSCLIENT                                               
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_NONBUSINESSDAY ADD                                                
CONSTRAINT C_CALENDARNONBUSINESSDAY                                             
FOREIGN KEY (                                                                   
C_CALENDAR_ID                                                                   
) REFERENCES C_CALENDAR (                                                       
C_CALENDAR_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_NONBUSINESSDAY ADD                                                
CONSTRAINT C_NONBUSINESDAYSORG                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CCAMPAIGN_CORDER                                                     
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT MSHIPPER_CORDER                                                      
FOREIGN KEY (                                                                   
M_SHIPPER_ID                                                                    
) REFERENCES M_SHIPPER (                                                        
M_SHIPPER_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CPROJECT_CORDER                                                      
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CPAYMENT_CORDER                                                      
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CORDER_REF                                                           
FOREIGN KEY (                                                                   
REF_ORDER_ID                                                                    
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CBPARTNERPAY_CORDER                                                  
FOREIGN KEY (                                                                   
PAY_BPARTNER_ID                                                                 
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT ADUSER_CORDER                                                        
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT ADUSER_SR_CORDER                                                     
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CBPARTNERBILL_CORDER                                                 
FOREIGN KEY (                                                                   
BILL_BPARTNER_ID                                                                
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CBPARTNER_CORDER                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CCASHLINE_CORDER                                                     
FOREIGN KEY (                                                                   
C_CASHLINE_ID                                                                   
) REFERENCES C_CASHLINE (                                                       
C_CASHLINE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CACTIVITY_CORDER                                                     
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CCHARGE_CORDER                                                       
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT C_DOCTYPE_CORDER                                                     
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT MPRICELIST_SOHEADER                                                  
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT ADORGTRX_CORDER                                                      
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT ADORG_CORDER                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT ADUSERBILL_CORDER                                                    
FOREIGN KEY (                                                                   
BILL_USER_ID                                                                    
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CBPARTNERLOCATION_CORDER                                             
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CCONVERSIONTYPE_CORDER                                               
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CBPLOCATIONBILL_CORDER                                               
FOREIGN KEY (                                                                   
BILL_LOCATION_ID                                                                
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CBPLOCATIONPAY_CORDER                                                
FOREIGN KEY (                                                                   
PAY_LOCATION_ID                                                                 
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CCURRENCY_CORDER                                                     
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CDOCTYPETARGET_CORDER                                                
FOREIGN KEY (                                                                   
C_DOCTYPETARGET_ID                                                              
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CELEMENRVALUEUSER2_CORDER                                            
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CELEMENTVALUEUSER1_CORDER                                            
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT MWAREHOUSE_CORDER                                                    
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_ORDER ADD                                                         
CONSTRAINT CPAYMENTTERM_SOHEADER                                                
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT CORDERLINE_REF                                                       
FOREIGN KEY (                                                                   
REF_ORDERLINE_ID                                                                
) REFERENCES C_ORDERLINE (                                                      
C_ORDERLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT CTAX_CORDERLINE                                                      
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT MWAREHOUSE_CORDERLINE                                                
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT MATTRSETINST_CORDERLINE                                              
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT CCHARGE_CORDERLINE                                                   
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT CBPARTNERLOCATION_SOLINE                                             
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT CORDER_CORDERLINE                                                    
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT CUOM_CORDERLINE                                                      
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT MPRODUCT_CORDERLINE                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT MSHIPPER_CORDERLINE                                                  
FOREIGN KEY (                                                                   
M_SHIPPER_ID                                                                    
) REFERENCES M_SHIPPER (                                                        
M_SHIPPER_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT SRESOURCEASSIGN_CORDERLINE                                           
FOREIGN KEY (                                                                   
S_RESOURCEASSIGNMENT_ID                                                         
) REFERENCES S_RESOURCEASSIGNMENT (                                             
S_RESOURCEASSIGNMENT_ID                                                         
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT CBPARTNER_SOLINE                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDERLINE ADD                                                     
CONSTRAINT CCURRENCY_CORDERLINE                                                 
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_ORDERTAX ADD                                                      
CONSTRAINT CTAX_CORDERTAX                                                       
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_ORDERTAX ADD                                                      
CONSTRAINT CORDER_CORDERTAX                                                     
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_ORGASSIGNMENT ADD                                                 
CONSTRAINT ADUSER_CORGASSIGNMENT                                                
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_ORGASSIGNMENT ADD                                                 
CONSTRAINT ADORG_CORGASSIGNMENT                                                 
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CELEMENTVALUEUSER2_CPAYMENT                                          
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CCURRENCY_CPAYMENT                                                   
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CBPBANKACCT_CPAYMENT                                                 
FOREIGN KEY (                                                                   
C_BP_BANKACCOUNT_ID                                                             
) REFERENCES C_BP_BANKACCOUNT (                                                 
C_BP_BANKACCOUNT_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CCAMPAIGN_CPAYMENT                                                   
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CBANKACCOUNT_CPAYMENT                                                
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CPAYMENTBATCH_CPAYMENT                                               
FOREIGN KEY (                                                                   
C_PAYMENTBATCH_ID                                                               
) REFERENCES C_PAYMENTBATCH (                                                   
C_PAYMENTBATCH_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CPROJECT_CPAYMENT                                                    
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT ADORGTRX_CPAYMENT                                                    
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT ADORG_CPAYMENT                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CACTIVITY_CPAYMENT                                                   
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CBPARTNER_CPAYMENT                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CCHARGE_CPAYMENT                                                     
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CCONVERSIONTYPE_CPAYMENT                                             
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CDOCTYPE_CPAYMENT                                                    
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENT ADD                                                       
CONSTRAINT CELEMENTVALUEUSER1_CPAYMENT                                          
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENTBATCH ADD                                                  
CONSTRAINT CPAYMTPROCESSOR_CPAYMTBATCH                                          
FOREIGN KEY (                                                                   
C_PAYMENTPROCESSOR_ID                                                           
) REFERENCES C_PAYMENTPROCESSOR (                                               
C_PAYMENTPROCESSOR_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENTPROCESSOR ADD                                              
CONSTRAINT CCURRENCY_CPAYMENTPROCESSOR                                          
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENTPROCESSOR ADD                                              
CONSTRAINT CBANKACCOUNT_CPAYMTPROCESSOR                                         
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENTPROCESSOR ADD                                              
CONSTRAINT ADSEQUENCE_CPAYMENTPROCESSOR                                         
FOREIGN KEY (                                                                   
AD_SEQUENCE_ID                                                                  
) REFERENCES AD_SEQUENCE (                                                      
AD_SEQUENCE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_PAYMENTTERM_TRL ADD                                               
CONSTRAINT CPAYMENTTERM_CPAYTERMTRL                                             
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_PAYMENTTERM_TRL ADD                                               
CONSTRAINT ADLANGUAGE_CPAYMENTTERMTRL                                           
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_PAYSCHEDULE ADD                                                   
CONSTRAINT CPAYMENTTERM_CPAYSCHEDULE                                            
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_PAYSELECTION ADD                                                  
CONSTRAINT CBANKACCOUNT_CPAYSELECTION                                           
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_PAYSELECTIONCHECK ADD                                             
CONSTRAINT CPAYSELECTION_CPAYSELECTCHECK                                        
FOREIGN KEY (                                                                   
C_PAYSELECTION_ID                                                               
) REFERENCES C_PAYSELECTION (                                                   
C_PAYSELECTION_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_PAYSELECTIONCHECK ADD                                             
CONSTRAINT CPAYMENT_CPAYSELECTIONCHECK                                          
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PAYSELECTIONCHECK ADD                                             
CONSTRAINT CBPARTNER_CPAYSELECTIONCHECK                                         
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PAYSELECTIONLINE ADD                                              
CONSTRAINT CPAYSEL_CPAYSELLINE                                                  
FOREIGN KEY (                                                                   
C_PAYSELECTION_ID                                                               
) REFERENCES C_PAYSELECTION (                                                   
C_PAYSELECTION_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_PAYSELECTIONLINE ADD                                              
CONSTRAINT CPAYSELCHECK_CPAYSELLINE                                             
FOREIGN KEY (                                                                   
C_PAYSELECTIONCHECK_ID                                                          
) REFERENCES C_PAYSELECTIONCHECK (                                              
C_PAYSELECTIONCHECK_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_PAYSELECTIONLINE ADD                                              
CONSTRAINT CINVOICE_CPAYSELECTLINE                                              
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PERIOD ADD                                                        
CONSTRAINT C_YEAR_PERIOD                                                        
FOREIGN KEY (                                                                   
C_YEAR_ID                                                                       
) REFERENCES C_YEAR (                                                           
C_YEAR_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PERIOD ADD                                                        
CONSTRAINT C_PERIODORG                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PERIOD ADD                                                        
CONSTRAINT C_PERIODCLIENT                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PERIODCONTROL ADD                                                 
CONSTRAINT C_PERIOD_PERIODCONTROL                                               
FOREIGN KEY (                                                                   
C_PERIOD_ID                                                                     
) REFERENCES C_PERIOD (                                                         
C_PERIOD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_PHASE ADD                                                         
CONSTRAINT MPRODUCT_CPHASE                                                      
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PHASE ADD                                                         
CONSTRAINT CPROJECTTYPE_CPHASE                                                  
FOREIGN KEY (                                                                   
C_PROJECTTYPE_ID                                                                
) REFERENCES C_PROJECTTYPE (                                                    
C_PROJECTTYPE_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_POS ADD                                                           
CONSTRAINT CPOSKEYLAYOUT_CPOS                                                   
FOREIGN KEY (                                                                   
C_POSKEYLAYOUT_ID                                                               
) REFERENCES C_POSKEYLAYOUT (                                                   
C_POSKEYLAYOUT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_POS ADD                                                           
CONSTRAINT ADUSER_CPOS                                                          
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_POS ADD                                                           
CONSTRAINT MPRICELIST_CPOS                                                      
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_POS ADD                                                           
CONSTRAINT CCASHBOOK_CPOS                                                       
FOREIGN KEY (                                                                   
C_CASHBOOK_ID                                                                   
) REFERENCES C_CASHBOOK (                                                       
C_CASHBOOK_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_POS ADD                                                           
CONSTRAINT MWAREHOUSE_CPOS                                                      
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_POSKEY ADD                                                        
CONSTRAINT MPRODUCT_CPOSKEY                                                     
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_POSKEY ADD                                                        
CONSTRAINT CPOSKEYLAYOUT_C_POSKEY                                               
FOREIGN KEY (                                                                   
C_POSKEYLAYOUT_ID                                                               
) REFERENCES C_POSKEYLAYOUT (                                                   
C_POSKEYLAYOUT_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT CCURRENCY_CPROJECT                                                   
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT MPRICELISTVERSION_CPROJECT                                           
FOREIGN KEY (                                                                   
M_PRICELIST_VERSION_ID                                                          
) REFERENCES M_PRICELIST_VERSION (                                              
M_PRICELIST_VERSION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT CBPARTNER_CPROJECT                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT ADUSER_CPROJECT                                                      
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT ADUSER_SR_CPROJECT                                                   
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT CCAMPAIGN_CPROJECT                                                   
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT CPHASE_CPROJECT                                                      
FOREIGN KEY (                                                                   
C_PHASE_ID                                                                      
) REFERENCES C_PHASE (                                                          
C_PHASE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT CPROJECTTYPE_CPROJECT                                                
FOREIGN KEY (                                                                   
C_PROJECTTYPE_ID                                                                
) REFERENCES C_PROJECTTYPE (                                                    
C_PROJECTTYPE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT CPAYMENTTERM_CPROJECT                                                
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT CBPLOCATION_CPROJECT                                                 
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT ADORG_CPROJECT                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT ADCLIENT_CPROJECT                                                    
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT ADD                                                       
CONSTRAINT MWAREHOUSE_CPROJECT                                                  
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTISSUE ADD                                                  
CONSTRAINT MPRODUCT_CPROJECTISSUE                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTISSUE ADD                                                  
CONSTRAINT CPROJECT_CPROJECTISSUE                                               
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTISSUE ADD                                                  
CONSTRAINT STIMEEXPLINE_CPROJECTISSUE                                           
FOREIGN KEY (                                                                   
S_TIMEEXPENSELINE_ID                                                            
) REFERENCES S_TIMEEXPENSELINE (                                                
S_TIMEEXPENSELINE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTISSUE ADD                                                  
CONSTRAINT MLOCATOR_CPROJECTISSUE                                               
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTISSUE ADD                                                  
CONSTRAINT MATTRSETINST_CPROJECTISSUE                                           
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTISSUE ADD                                                  
CONSTRAINT MINOUTLINE_CPROJECTISSUE                                             
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTISSUEMA ADD                                                
CONSTRAINT MASI_CPROJECTISSUEMA                                                 
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTISSUEMA ADD                                                
CONSTRAINT CPROJECTISSUE_CPROJECTISSUEMA                                        
FOREIGN KEY (                                                                   
C_PROJECTISSUE_ID                                                               
) REFERENCES C_PROJECTISSUE (                                                   
C_PROJECTISSUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTLINE ADD                                                   
CONSTRAINT CORDERPO_CPROJECTLINE                                                
FOREIGN KEY (                                                                   
C_ORDERPO_ID                                                                    
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTLINE ADD                                                   
CONSTRAINT CPROJECT_CPROJECTLINE                                                
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_PROJECTLINE ADD                                                   
CONSTRAINT CORDER_CPROJECTLINE                                                  
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTLINE ADD                                                   
CONSTRAINT CPROJECTISSUE_CPROJECTLINE                                           
FOREIGN KEY (                                                                   
C_PROJECTISSUE_ID                                                               
) REFERENCES C_PROJECTISSUE (                                                   
C_PROJECTISSUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTLINE ADD                                                   
CONSTRAINT MPRODUCTCAT_CPROJECTLINE                                             
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTLINE ADD                                                   
CONSTRAINT MPRODUCT_CPROJECTLINE                                                
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTPHASE ADD                                                  
CONSTRAINT CPROJECT_CPROJECTPHASE                                               
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTPHASE ADD                                                  
CONSTRAINT MPRODUCT_CPROJECTPHASE                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTPHASE ADD                                                  
CONSTRAINT CORDER_CPROJECTPHASE                                                 
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTPHASE ADD                                                  
CONSTRAINT CPHASE_CPROJECTPHASE                                                 
FOREIGN KEY (                                                                   
C_PHASE_ID                                                                      
) REFERENCES C_PHASE (                                                          
C_PHASE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTTASK ADD                                                   
CONSTRAINT CTASK_CPROJECTTASK                                                   
FOREIGN KEY (                                                                   
C_TASK_ID                                                                       
) REFERENCES C_TASK (                                                           
C_TASK_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_PROJECTTASK ADD                                                   
CONSTRAINT CPROJECTPHASE_CPROJECTTASK                                           
FOREIGN KEY (                                                                   
C_PROJECTPHASE_ID                                                               
) REFERENCES C_PROJECTPHASE (                                                   
C_PROJECTPHASE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_PROJECTTASK ADD                                                   
CONSTRAINT MPRODUCT_CPROJECTTASK                                                
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT_ACCT ADD                                                  
CONSTRAINT VC_PJASSET_CPROJECT                                                  
FOREIGN KEY (                                                                   
PJ_ASSET_ACCT                                                                   
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT_ACCT ADD                                                  
CONSTRAINT CACCTSCHEMA_CPROJECTACCT                                             
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_PROJECT_ACCT ADD                                                  
CONSTRAINT VC_PJWIP_CPROJECT                                                    
FOREIGN KEY (                                                                   
PJ_WIP_ACCT                                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_PROJECT_ACCT ADD                                                  
CONSTRAINT C_PROJECT_PROJECTACCT                                                
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RECURRING ADD                                                     
CONSTRAINT CINVOICE_CRECURRING                                                  
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING ADD                                                     
CONSTRAINT GLJOURNALBATCH_CRECURRING                                            
FOREIGN KEY (                                                                   
GL_JOURNALBATCH_ID                                                              
) REFERENCES GL_JOURNALBATCH (                                                  
GL_JOURNALBATCH_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING ADD                                                     
CONSTRAINT CORDER_CRECURRING                                                    
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING ADD                                                     
CONSTRAINT CPAYMENT_CRECURRING                                                  
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING ADD                                                     
CONSTRAINT CPROJECT_CRECURRING                                                  
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING_RUN ADD                                                 
CONSTRAINT CPROJECT_CRECURRINGRUN                                               
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING_RUN ADD                                                 
CONSTRAINT CORDER_CRECURRINGRUN                                                 
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING_RUN ADD                                                 
CONSTRAINT GLJOURNALBATCH_CRECURRINGRUN                                         
FOREIGN KEY (                                                                   
GL_JOURNALBATCH_ID                                                              
) REFERENCES GL_JOURNALBATCH (                                                  
GL_JOURNALBATCH_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING_RUN ADD                                                 
CONSTRAINT CPAYMENT_CRECURRINGRUN                                               
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING_RUN ADD                                                 
CONSTRAINT CINVOICE_CRECURRINGRUN                                               
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RECURRING_RUN ADD                                                 
CONSTRAINT CRECURRING_CRECURRINGRUN                                             
FOREIGN KEY (                                                                   
C_RECURRING_ID                                                                  
) REFERENCES C_RECURRING (                                                      
C_RECURRING_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_REGION ADD                                                        
CONSTRAINT C_REGIONCLIENT                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_REGION ADD                                                        
CONSTRAINT C_REGIONORG                                                          
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_REGION ADD                                                        
CONSTRAINT CCOUNTRY_CREGION                                                     
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_REVENUERECOGNITION_PLAN ADD                                       
CONSTRAINT VC_UNEARNEDREVENUE_CREVENUEREC                                       
FOREIGN KEY (                                                                   
UNEARNEDREVENUE_ACCT                                                            
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_REVENUERECOGNITION_PLAN ADD                                       
CONSTRAINT CINVOICELINE_CREVENUERECPLAN                                         
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_REVENUERECOGNITION_PLAN ADD                                       
CONSTRAINT CCURRENCY_CREVENUERECPLAN                                            
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_REVENUERECOGNITION_PLAN ADD                                       
CONSTRAINT VC_PREVENUE_CREVENUERECOGNITIO                                       
FOREIGN KEY (                                                                   
P_REVENUE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_REVENUERECOGNITION_PLAN ADD                                       
CONSTRAINT CACCTSCHEMA_CREVRECPLAN                                              
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE C_REVENUERECOGNITION_PLAN ADD                                       
CONSTRAINT CREVENUERECOGNITION_PLAN                                             
FOREIGN KEY (                                                                   
C_REVENUERECOGNITION_ID                                                         
) REFERENCES C_REVENUERECOGNITION (                                             
C_REVENUERECOGNITION_ID                                                         
)                                                                               
;                                                                               
ALTER TABLE C_REVENUERECOGNITION_RUN ADD                                        
CONSTRAINT GLJOURNAL_CREVENUERECRUN                                             
FOREIGN KEY (                                                                   
GL_JOURNAL_ID                                                                   
) REFERENCES GL_JOURNAL (                                                       
GL_JOURNAL_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_REVENUERECOGNITION_RUN ADD                                        
CONSTRAINT CREVRECPLAN_CREFRECRUN                                               
FOREIGN KEY (                                                                   
C_REVENUERECOGNITION_PLAN_ID                                                    
) REFERENCES C_REVENUERECOGNITION_PLAN (                                        
C_REVENUERECOGNITION_PLAN_ID                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RFQ ADD                                                           
CONSTRAINT CBPLOCATION_CRFQ                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_RFQ ADD                                                           
CONSTRAINT CCURRENCY_CRFQ                                                       
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_RFQ ADD                                                           
CONSTRAINT CORDER_CRFQ                                                          
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_RFQ ADD                                                           
CONSTRAINT CRFQTOPIC_CRFQ                                                       
FOREIGN KEY (                                                                   
C_RFQ_TOPIC_ID                                                                  
) REFERENCES C_RFQ_TOPIC (                                                      
C_RFQ_TOPIC_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE C_RFQ ADD                                                           
CONSTRAINT CBPARTNER_CRFQ                                                       
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_RFQ ADD                                                           
CONSTRAINT ADUSERSALESREP_CRFQ                                                  
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_RFQ ADD                                                           
CONSTRAINT ADUSER_CRFQ                                                          
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_RFQLINE ADD                                                       
CONSTRAINT CRFQ_CRFQLINE                                                        
FOREIGN KEY (                                                                   
C_RFQ_ID                                                                        
) REFERENCES C_RFQ (                                                            
C_RFQ_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQLINE ADD                                                       
CONSTRAINT MASETINSTANCE_CRFQLINE                                               
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE C_RFQLINE ADD                                                       
CONSTRAINT MPRODUCT_CRFQLINE                                                    
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RFQLINEQTY ADD                                                    
CONSTRAINT CUOM_CRFQLINEQTY                                                     
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_RFQLINEQTY ADD                                                    
CONSTRAINT CRFQLINE_CRFQLINEQTY                                                 
FOREIGN KEY (                                                                   
C_RFQLINE_ID                                                                    
) REFERENCES C_RFQLINE (                                                        
C_RFQLINE_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQRESPONSE ADD                                                   
CONSTRAINT ADUSER_CRFQRESPONSE                                                  
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_RFQRESPONSE ADD                                                   
CONSTRAINT CBPLOCATION_CRFQRESPONSE                                             
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_RFQRESPONSE ADD                                                   
CONSTRAINT CBPARTNER_CRFQRESPONSE                                               
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_RFQRESPONSE ADD                                                   
CONSTRAINT CCURRENCY_CRFQRESPONSE                                               
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_RFQRESPONSE ADD                                                   
CONSTRAINT CORDER_CRFQRESPONSE                                                  
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_RFQRESPONSE ADD                                                   
CONSTRAINT CRFQ_CRFQRESPONSE                                                    
FOREIGN KEY (                                                                   
C_RFQ_ID                                                                        
) REFERENCES C_RFQ (                                                            
C_RFQ_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQRESPONSELINE ADD                                               
CONSTRAINT CRFQRESPONSE_LINE                                                    
FOREIGN KEY (                                                                   
C_RFQRESPONSE_ID                                                                
) REFERENCES C_RFQRESPONSE (                                                    
C_RFQRESPONSE_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQRESPONSELINE ADD                                               
CONSTRAINT CRFQLINE_CRFQRESPONSELINE                                            
FOREIGN KEY (                                                                   
C_RFQLINE_ID                                                                    
) REFERENCES C_RFQLINE (                                                        
C_RFQLINE_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQRESPONSELINEQTY ADD                                            
CONSTRAINT CRFQLINEQTY_CRFQRESPLINEQTY                                          
FOREIGN KEY (                                                                   
C_RFQLINEQTY_ID                                                                 
) REFERENCES C_RFQLINEQTY (                                                     
C_RFQLINEQTY_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQRESPONSELINEQTY ADD                                            
CONSTRAINT CRFQRESONSELINE_QTY                                                  
FOREIGN KEY (                                                                   
C_RFQRESPONSELINE_ID                                                            
) REFERENCES C_RFQRESPONSELINE (                                                
C_RFQRESPONSELINE_ID                                                            
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQ_TOPIC ADD                                                     
CONSTRAINT ADPRINTFORMAT_ARFQTOPIC                                              
FOREIGN KEY (                                                                   
AD_PRINTFORMAT_ID                                                               
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_RFQ_TOPICSUBSCRIBER ADD                                           
CONSTRAINT C_RFQTOPIC_SUBSCRIBER                                                
FOREIGN KEY (                                                                   
C_RFQ_TOPIC_ID                                                                  
) REFERENCES C_RFQ_TOPIC (                                                      
C_RFQ_TOPIC_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQ_TOPICSUBSCRIBER ADD                                           
CONSTRAINT CBPARTNER_CRFQTOPICSUBR                                              
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_RFQ_TOPICSUBSCRIBER ADD                                           
CONSTRAINT CBPARTNERLOC_CRFQTOPICSUBR                                           
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE C_RFQ_TOPICSUBSCRIBER ADD                                           
CONSTRAINT ADUSER_ARFQTOPICSUBCR                                                
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_RFQ_TOPICSUBSCRIBERONLY ADD                                       
CONSTRAINT MPRODUCT_CRFQTSUBONLY                                                
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_RFQ_TOPICSUBSCRIBERONLY ADD                                       
CONSTRAINT CRFQTOPICSUBSCRIBER_ONLY                                             
FOREIGN KEY (                                                                   
C_RFQ_TOPICSUBSCRIBER_ID                                                        
) REFERENCES C_RFQ_TOPICSUBSCRIBER (                                            
C_RFQ_TOPICSUBSCRIBER_ID                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_RFQ_TOPICSUBSCRIBERONLY ADD                                       
CONSTRAINT MPRODCATEGORY_CRFQTSUBONLY                                           
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_SERVICELEVEL ADD                                                  
CONSTRAINT MPRODUCT_CSERVICELEVEL                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_SERVICELEVEL ADD                                                  
CONSTRAINT CREVRECPLAN_CSERVICELEVEL                                            
FOREIGN KEY (                                                                   
C_REVENUERECOGNITION_PLAN_ID                                                    
) REFERENCES C_REVENUERECOGNITION_PLAN (                                        
C_REVENUERECOGNITION_PLAN_ID                                                    
)                                                                               
;                                                                               
ALTER TABLE C_SERVICELEVELLINE ADD                                              
CONSTRAINT CSERVICELEVEL_LINE                                                   
FOREIGN KEY (                                                                   
C_SERVICELEVEL_ID                                                               
) REFERENCES C_SERVICELEVEL (                                                   
C_SERVICELEVEL_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_SUBSCRIPTION ADD                                                  
CONSTRAINT CBPARTNER_CSUBSCRIPTION                                              
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_SUBSCRIPTION ADD                                                  
CONSTRAINT CSUBSCRTYPE_CSUBSCRIPTION                                            
FOREIGN KEY (                                                                   
C_SUBSCRIPTIONTYPE_ID                                                           
) REFERENCES C_SUBSCRIPTIONTYPE (                                               
C_SUBSCRIPTIONTYPE_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_SUBSCRIPTION ADD                                                  
CONSTRAINT MPRODUCT_CSUBSCRIPTION                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_SUBSCRIPTION_DELIVERY ADD                                         
CONSTRAINT CSUBCRIPTION_CSUBSCRDELIVERY                                         
FOREIGN KEY (                                                                   
C_SUBSCRIPTION_ID                                                               
) REFERENCES C_SUBSCRIPTION (                                                   
C_SUBSCRIPTION_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_TASK ADD                                                          
CONSTRAINT CPHASE_CTASK                                                         
FOREIGN KEY (                                                                   
C_PHASE_ID                                                                      
) REFERENCES C_PHASE (                                                          
C_PHASE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_TASK ADD                                                          
CONSTRAINT MPRODUCT_CTASK                                                       
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_TAX ADD                                                           
CONSTRAINT CTAXCATEGORY_CTAX                                                    
FOREIGN KEY (                                                                   
C_TAXCATEGORY_ID                                                                
) REFERENCES C_TAXCATEGORY (                                                    
C_TAXCATEGORY_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_TAX ADD                                                           
CONSTRAINT C_COUNTRYTO_C_TAX                                                    
FOREIGN KEY (                                                                   
TO_COUNTRY_ID                                                                   
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_TAX ADD                                                           
CONSTRAINT C_REGIONTO_C_TAX                                                     
FOREIGN KEY (                                                                   
TO_REGION_ID                                                                    
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_TAX ADD                                                           
CONSTRAINT C_REGION_C_TAX                                                       
FOREIGN KEY (                                                                   
C_REGION_ID                                                                     
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_TAX ADD                                                           
CONSTRAINT CTAX_PARENT                                                          
FOREIGN KEY (                                                                   
PARENT_TAX_ID                                                                   
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_TAX ADD                                                           
CONSTRAINT C_COUNTRY_C_TAX                                                      
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_TAXCATEGORY_TRL ADD                                               
CONSTRAINT ADLANGUAGE_CTAXCATEGORYTRL                                           
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE C_TAXCATEGORY_TRL ADD                                               
CONSTRAINT CTAXCATEGORY_TRL                                                     
FOREIGN KEY (                                                                   
C_TAXCATEGORY_ID                                                                
) REFERENCES C_TAXCATEGORY (                                                    
C_TAXCATEGORY_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_TAXPOSTAL ADD                                                     
CONSTRAINT CTAX_CTAXPOSTAL                                                      
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_TAX_ACCT ADD                                                      
CONSTRAINT CACCTSCHEMA_CTAXACCT                                                 
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_TAX_ACCT ADD                                                      
CONSTRAINT VC_TEXPENSE_CTAX                                                     
FOREIGN KEY (                                                                   
T_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_TAX_ACCT ADD                                                      
CONSTRAINT CTAX_CTAXACCT                                                        
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_TAX_ACCT ADD                                                      
CONSTRAINT VC_TCREDIT_CTAX                                                      
FOREIGN KEY (                                                                   
T_CREDIT_ACCT                                                                   
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_TAX_ACCT ADD                                                      
CONSTRAINT VC_TLIABILITY_CTAX                                                   
FOREIGN KEY (                                                                   
T_LIABILITY_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_TAX_ACCT ADD                                                      
CONSTRAINT VC_TDUE_CTAX                                                         
FOREIGN KEY (                                                                   
T_DUE_ACCT                                                                      
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_TAX_ACCT ADD                                                      
CONSTRAINT VC_TREC_CTAX                                                         
FOREIGN KEY (                                                                   
T_RECEIVABLES_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_TAX_TRL ADD                                                       
CONSTRAINT CTAX_CTAXTRL                                                         
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_TAX_TRL ADD                                                       
CONSTRAINT ADLANGUAGE_CTAXTRL                                                   
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_UOM ADD                                                           
CONSTRAINT C_UOMORG                                                             
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_UOM ADD                                                           
CONSTRAINT C_UOMCLIENT                                                          
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_UOM_CONVERSION ADD                                                
CONSTRAINT C_UOM_CONVERSIONORG                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_UOM_CONVERSION ADD                                                
CONSTRAINT C_UOM_CONVERSIONCLIENT                                               
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_UOM_CONVERSION ADD                                                
CONSTRAINT CUOM_CUOMCONVERSION                                                  
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_UOM_CONVERSION ADD                                                
CONSTRAINT C_UOMCONVERSIONTO                                                    
FOREIGN KEY (                                                                   
C_UOM_TO_ID                                                                     
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE C_UOM_TRL ADD                                                       
CONSTRAINT CUOM_CUOMTRL                                                         
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_UOM_TRL ADD                                                       
CONSTRAINT ADLANGUAGE_CUOMTRL                                                   
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_USERREMUNERATION ADD                                              
CONSTRAINT ADUSER_CUSERREMUNERATION                                             
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE C_USERREMUNERATION ADD                                              
CONSTRAINT CREMUNERATION_CUSERREM                                               
FOREIGN KEY (                                                                   
C_REMUNERATION_ID                                                               
) REFERENCES C_REMUNERATION (                                                   
C_REMUNERATION_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT CACCTSCHEMA_CVALIDCOMBINATION                                        
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT ADORGTRX_VC                                                          
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT CELEMENTVALUEUSER1_VC                                                
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT MPRODUCT_VC                                                          
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT CSALESREGION_VC                                                      
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT CACTIVITY_CVALIDCOMBINATION                                          
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT CBPARTNER_VC                                                         
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT CELEMENTVALUEACCOUNT_VC                                              
FOREIGN KEY (                                                                   
ACCOUNT_ID                                                                      
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT CELEMENTVALUEUSER2_VC                                                
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT CPROJECT_VC                                                          
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT MLOCATIONTO_VC                                                       
FOREIGN KEY (                                                                   
C_LOCTO_ID                                                                      
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT SOCAMPAIGN_VC                                                        
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT MLOCATIONFROM_VC                                                     
FOREIGN KEY (                                                                   
C_LOCFROM_ID                                                                    
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT ADCLIENT_VC                                                          
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE C_VALIDCOMBINATION ADD                                              
CONSTRAINT ADORG_VC                                                             
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_WITHHOLDING ADD                                                   
CONSTRAINT CPAYMENTTERM_CWITHHOLDING                                            
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_WITHHOLDING_ACCT ADD                                              
CONSTRAINT CWITHHOLDING_CWITHHOLDINGACCT                                        
FOREIGN KEY (                                                                   
C_WITHHOLDING_ID                                                                
) REFERENCES C_WITHHOLDING (                                                    
C_WITHHOLDING_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE C_WITHHOLDING_ACCT ADD                                              
CONSTRAINT VC_WITHHOLDING_CWITHHOLDING                                          
FOREIGN KEY (                                                                   
WITHHOLDING_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE C_WITHHOLDING_ACCT ADD                                              
CONSTRAINT CACCTSCHEMA_CWITHHOLDINGACCT                                         
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE C_YEAR ADD                                                          
CONSTRAINT C_YEARORG                                                            
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE C_YEAR ADD                                                          
CONSTRAINT C_CALENDAR_YEAR                                                      
FOREIGN KEY (                                                                   
C_CALENDAR_ID                                                                   
) REFERENCES C_CALENDAR (                                                       
C_CALENDAR_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE C_YEAR ADD                                                          
CONSTRAINT C_YEARCLIENT                                                         
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT C_SALESREGION_FACTACCT                                               
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT M_PRODUCT_FACT_ACCT                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT GLBUDGET_FACTACCT                                                    
FOREIGN KEY (                                                                   
GL_BUDGET_ID                                                                    
) REFERENCES GL_BUDGET (                                                        
GL_BUDGET_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT CACCTSCHEMA_FACTACCT                                                 
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT CELEMENTVALUEUSER1_FACTACCT                                          
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT C_CURRENCY_FACT_ACCT                                                 
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT AD_ORGTRX_FACT_ACCT                                                  
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT C_BUSPARTNER_FACT_ACCT                                               
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT C_LOCATIONTO_FACT_ACCT                                               
FOREIGN KEY (                                                                   
C_LOCTO_ID                                                                      
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT C_PROJECT_FACT_ACCT                                                  
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT C_UOM_FACT_ACCT                                                      
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT GLCATEGORY_FACTACCT                                                  
FOREIGN KEY (                                                                   
GL_CATEGORY_ID                                                                  
) REFERENCES GL_CATEGORY (                                                      
GL_CATEGORY_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT MLOCATOR_FACTACCT                                                    
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT SO_CAMPAIGN_FACT_ACCT                                                
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT AASSET_FACTACCT                                                      
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT AC_CLIENT_FACT_ACCT                                                  
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT CACTIVITY_FACTACCT                                                   
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT C_LOCATIONFROM_FACT_ACCT                                             
FOREIGN KEY (                                                                   
C_LOCFROM_ID                                                                    
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT CELEMENTVALUEUSER2_FACTACCT                                          
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT CELEMENTVALUE_FACTACCT                                               
FOREIGN KEY (                                                                   
ACCOUNT_ID                                                                      
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT ADTABLE_FACTACCT                                                     
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT CPERIOD_FACTACCT                                                     
FOREIGN KEY (                                                                   
C_PERIOD_ID                                                                     
) REFERENCES C_PERIOD (                                                         
C_PERIOD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT CTAX_FACTACCT                                                        
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT ADD                                                       
CONSTRAINT AD_ORG_FACT_ACCT                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT ADORGTRX_FACTACCTBAL                                                 
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CELEMENTVALUEACCT_FACTACCTBAL                                        
FOREIGN KEY (                                                                   
ACCOUNT_ID                                                                      
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT GLBUDGET_FACTACCTBALANCE                                             
FOREIGN KEY (                                                                   
GL_BUDGET_ID                                                                    
) REFERENCES GL_BUDGET (                                                        
GL_BUDGET_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CSALESREGION_FACTACCTBAL                                             
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT MPRODUCT_FACTACCTBAL                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CLOCFROM_FACTACCTBALANCE                                             
FOREIGN KEY (                                                                   
C_LOCFROM_ID                                                                    
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT ADCLIENT_FACTACCTBAL                                                 
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CPROJECT_FACTACCTBAL                                                 
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT ADORG_FACTACCTBAL                                                    
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CACCTSCHEMA_FACTACCTBAL                                              
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CACTIVITY_FACTACCTBAL                                                
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CBPARTNER_FACTACCTBAL                                                
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CCAMPAIGN_FACTACCTBAL                                                
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CELEMENTVALUEU2_FACTACCTBAL                                          
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CLOCTO_FACTACCTBAL                                                   
FOREIGN KEY (                                                                   
C_LOCTO_ID                                                                      
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE FACT_ACCT_BALANCE ADD                                               
CONSTRAINT CELEMENTVALUEU1_FACTACCTBAL                                          
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CSALESREGOPN_GLDIST                                                  
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CLOCFROM_GLDIST                                                      
FOREIGN KEY (                                                                   
C_LOCFROM_ID                                                                    
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CLOCTO_GLDIST                                                        
FOREIGN KEY (                                                                   
C_LOCTO_ID                                                                      
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CEVALUEACCT_GLDIST                                                   
FOREIGN KEY (                                                                   
ACCOUNT_ID                                                                      
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CEVALUEUSER2_GLDIST                                                  
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CPROJECT_GLDIST                                                      
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT MPRODUCT_GLDIST                                                      
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CACTIVITY_GLDIST                                                     
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT ADORGORG_GLDIST                                                      
FOREIGN KEY (                                                                   
ORG_ID                                                                          
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT ADORGTRX_GLDIST                                                      
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT ADORG_GLDIST                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CBPARTNER_GLDIST                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CACCTSCHEMA_GLDIST                                                   
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CDOCTYPE_GLDISTRIBUTION                                              
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CCAMPAIGN_GLDIST                                                     
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTION ADD                                                 
CONSTRAINT CEVALUEUSER1_GLDIST                                                  
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CPROJECT_GLDISTLINE                                                  
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CCAMPAIGN_GLDISTLINE                                                 
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CSALESREGION_GLDISTLINE                                              
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT MPRODUCT_GLDISTLINE                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CBPARTNER_GLDISTLINE                                                 
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT ADORGTRX_GLDISTLINE                                                  
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CLOCTO_GLDISTLINE                                                    
FOREIGN KEY (                                                                   
C_LOCTO_ID                                                                      
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CEVALUEUSER2_GLDISTLINE                                              
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CEVALUEACCT_GLDISTLINE                                               
FOREIGN KEY (                                                                   
ACCOUNT_ID                                                                      
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CEVALUEUSER1_GLDISTLINE                                              
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CLOCFROM_GLDISTLINE                                                  
FOREIGN KEY (                                                                   
C_LOCFROM_ID                                                                    
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT ADORGORG_GLDISTLINE                                                  
FOREIGN KEY (                                                                   
ORG_ID                                                                          
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT ADORG_GLDISTLINE                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT GLDISTRIBUTION_GLDISTLINE                                            
FOREIGN KEY (                                                                   
GL_DISTRIBUTION_ID                                                              
) REFERENCES GL_DISTRIBUTION (                                                  
GL_DISTRIBUTION_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE GL_DISTRIBUTIONLINE ADD                                             
CONSTRAINT CACTIVITY_GLDISTLINE                                                 
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT GLCATEGORY_GLJOURNAL                                                 
FOREIGN KEY (                                                                   
GL_CATEGORY_ID                                                                  
) REFERENCES GL_CATEGORY (                                                      
GL_CATEGORY_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT C_PERIOD_JOURNAL                                                     
FOREIGN KEY (                                                                   
C_PERIOD_ID                                                                     
) REFERENCES C_PERIOD (                                                         
C_PERIOD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT GLBUDGET_GLJOURNAL                                                   
FOREIGN KEY (                                                                   
GL_BUDGET_ID                                                                    
) REFERENCES GL_BUDGET (                                                        
GL_BUDGET_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT C_ACCTSCHEMA_GL_JOURNAL                                              
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT CDOCTYPE_GLJOURNAL                                                   
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT CCURRENCY_GLJOURNAL                                                  
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT GLJOURNALBATCH_GLJOURNAL                                             
FOREIGN KEY (                                                                   
GL_JOURNALBATCH_ID                                                              
) REFERENCES GL_JOURNALBATCH (                                                  
GL_JOURNALBATCH_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNAL ADD                                                      
CONSTRAINT CCONVERSIONTYPE_GLJOURNAL                                            
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALBATCH ADD                                                 
CONSTRAINT CCURRENCY_GLJOURNALBATCH                                             
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALBATCH ADD                                                 
CONSTRAINT CDOCTYPE_GLJOURNALBATCH                                              
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALBATCH ADD                                                 
CONSTRAINT GLCATEGORY_GLJOURNALBATCH                                            
FOREIGN KEY (                                                                   
GL_CATEGORY_ID                                                                  
) REFERENCES GL_CATEGORY (                                                      
GL_CATEGORY_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALBATCH ADD                                                 
CONSTRAINT C_PERIOD_JOURNALBATCH                                                
FOREIGN KEY (                                                                   
C_PERIOD_ID                                                                     
) REFERENCES C_PERIOD (                                                         
C_PERIOD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALLINE ADD                                                  
CONSTRAINT GLJOURNAL_GLJOURNALLINE                                              
FOREIGN KEY (                                                                   
GL_JOURNAL_ID                                                                   
) REFERENCES GL_JOURNAL (                                                       
GL_JOURNAL_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE GL_JOURNALLINE ADD                                                  
CONSTRAINT CVC_GLJOURNALLINE                                                    
FOREIGN KEY (                                                                   
C_VALIDCOMBINATION_ID                                                           
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALLINE ADD                                                  
CONSTRAINT CCURRENCY_GLJOURNALLINE                                              
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALLINE ADD                                                  
CONSTRAINT CCONVERSIONTYPE_GLJOURNALLINE                                        
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALLINE ADD                                                  
CONSTRAINT ADCLIENT_GLJOURNALLINE                                               
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALLINE ADD                                                  
CONSTRAINT ADORG_GLJOURNALLINE                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE GL_JOURNALLINE ADD                                                  
CONSTRAINT CUOM_GLJOURNALLINE                                                   
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT CPAYMENT_IBANKSTATEMENT                                              
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT CCURRENCY_IBANKSTATEMENT                                             
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT CBANKACCOUNT_IBANKSTATEMENT                                          
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT CBPARTNER_IBANKSTATEMENT                                             
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT CBANKSTATEMENT_IBANKSTATEMENT                                        
FOREIGN KEY (                                                                   
C_BANKSTATEMENT_ID                                                              
) REFERENCES C_BANKSTATEMENT (                                                  
C_BANKSTATEMENT_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT CBANKSTMTLINE_IBANKSTMT                                              
FOREIGN KEY (                                                                   
C_BANKSTATEMENTLINE_ID                                                          
) REFERENCES C_BANKSTATEMENTLINE (                                              
C_BANKSTATEMENTLINE_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT CCHARGE_IBANKSTMT                                                    
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE I_BANKSTATEMENT ADD                                                 
CONSTRAINT CINVOICE_IBANKSTATEMENT                                              
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_BPARTNER ADD                                                      
CONSTRAINT CGREETING_IBPARTNER                                                  
FOREIGN KEY (                                                                   
C_GREETING_ID                                                                   
) REFERENCES C_GREETING (                                                       
C_GREETING_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_BPARTNER ADD                                                      
CONSTRAINT CBPARTNERLOCATION_IBPARTNER                                          
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE I_BPARTNER ADD                                                      
CONSTRAINT CBPGROUP_IBPARTNER                                                   
FOREIGN KEY (                                                                   
C_BP_GROUP_ID                                                                   
) REFERENCES C_BP_GROUP (                                                       
C_BP_GROUP_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_BPARTNER ADD                                                      
CONSTRAINT ADUSER_IBPARTNER                                                     
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE I_BPARTNER ADD                                                      
CONSTRAINT CCOUNTRY_IPARTNER                                                    
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_BPARTNER ADD                                                      
CONSTRAINT CREGION_IBPARTNER                                                    
FOREIGN KEY (                                                                   
C_REGION_ID                                                                     
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE I_BPARTNER ADD                                                      
CONSTRAINT CBPARTNER_IBPARTNER                                                  
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_CONVERSION_RATE ADD                                               
CONSTRAINT CCURRENCY_ICONVRATETO                                                
FOREIGN KEY (                                                                   
C_CURRENCY_ID_TO                                                                
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_CONVERSION_RATE ADD                                               
CONSTRAINT CCONVTYPE_ICONVRATE                                                  
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE I_CONVERSION_RATE ADD                                               
CONSTRAINT CCONVERSIONRATE_ICONVRATE                                            
FOREIGN KEY (                                                                   
C_CONVERSION_RATE_ID                                                            
) REFERENCES C_CONVERSION_RATE (                                                
C_CONVERSION_RATE_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE I_CONVERSION_RATE ADD                                               
CONSTRAINT CCURRENCY_ICONVRATE                                                  
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_ELEMENTVALUE ADD                                                  
CONSTRAINT CELEMENTVALUE_IELEMENTVALUE                                          
FOREIGN KEY (                                                                   
C_ELEMENTVALUE_ID                                                               
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE I_ELEMENTVALUE ADD                                                  
CONSTRAINT CELEMENT_IELEMENTVALUE                                               
FOREIGN KEY (                                                                   
C_ELEMENT_ID                                                                    
) REFERENCES C_ELEMENT (                                                        
C_ELEMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_ELEMENTVALUE ADD                                                  
CONSTRAINT ADCOLUMN_IELEMENTVALUE                                               
FOREIGN KEY (                                                                   
AD_COLUMN_ID                                                                    
) REFERENCES AD_COLUMN (                                                        
AD_COLUMN_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_ELEMENTVALUE ADD                                                  
CONSTRAINT CEVALUEPARENT_IELEMENTVALUE                                          
FOREIGN KEY (                                                                   
PARENTELEMENTVALUE_ID                                                           
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT MPRODUCT_OGLJOURNAL                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CPROJECT_IGLJOURNAL                                                  
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CBPARTNER_IGLJOURNAL                                                 
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT GLBUDGET_IGLJOURNAL                                                  
FOREIGN KEY (                                                                   
GL_BUDGET_ID                                                                    
) REFERENCES GL_BUDGET (                                                        
GL_BUDGET_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CPERIOD_IGLJOURNAL                                                   
FOREIGN KEY (                                                                   
C_PERIOD_ID                                                                     
) REFERENCES C_PERIOD (                                                         
C_PERIOD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT ADORGTRX_IGLJOURNAL                                                  
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CCONVERSIONTYPE_IGLJOURNAL                                           
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CACTIVITY_GLJOURNAL                                                  
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT GLCATEGORY_IGLJOURNAL                                                
FOREIGN KEY (                                                                   
GL_CATEGORY_ID                                                                  
) REFERENCES GL_CATEGORY (                                                      
GL_CATEGORY_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT GLJOURNALBATCH_IGLJOURNAL                                            
FOREIGN KEY (                                                                   
GL_JOURNALBATCH_ID                                                              
) REFERENCES GL_JOURNALBATCH (                                                  
GL_JOURNALBATCH_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT GLJOURNAL_IGLJOURNAL                                                 
FOREIGN KEY (                                                                   
GL_JOURNAL_ID                                                                   
) REFERENCES GL_JOURNAL (                                                       
GL_JOURNAL_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CCAMPAIGN_IGLJOURNAL                                                 
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CCURRENCY_IGLJOURNAL                                                 
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CELVALUEACCOUNT_IGLJOURNAL                                           
FOREIGN KEY (                                                                   
ACCOUNT_ID                                                                      
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CELVALUEUSER2_IGLJOURNAL                                             
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CEVALUEUSER1_IGLJOURNAL                                              
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CLOCFROM_IGLJOURNAL                                                  
FOREIGN KEY (                                                                   
C_LOCFROM_ID                                                                    
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CSALESREGION_IGLJOURNAL                                              
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT ADORGDOC_IGLJOURNAL                                                  
FOREIGN KEY (                                                                   
AD_ORGDOC_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT ADORG_IGLJOURNAL                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CACCTSCHEMA_IGLJOURNAL                                               
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT GLJOURBELLINE_IGLJOURNAL                                             
FOREIGN KEY (                                                                   
GL_JOURNALLINE_ID                                                               
) REFERENCES GL_JOURNALLINE (                                                   
GL_JOURNALLINE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CVALIDCOMBINATION_IGLJOURNAL                                         
FOREIGN KEY (                                                                   
C_VALIDCOMBINATION_ID                                                           
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CDOCTYPE_IGLJOURNAL                                                  
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_GLJOURNAL ADD                                                     
CONSTRAINT CLOCTO_IGLJOURNAL                                                    
FOREIGN KEY (                                                                   
C_LOCTO_ID                                                                      
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_INOUTLINECONFIRM ADD                                              
CONSTRAINT MINOUTLINECONFIRM_IMPORT                                             
FOREIGN KEY (                                                                   
M_INOUTLINECONFIRM_ID                                                           
) REFERENCES M_INOUTLINECONFIRM (                                               
M_INOUTLINECONFIRM_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE I_INVENTORY ADD                                                     
CONSTRAINT MWAREHOUSE_IINVENTORY                                                
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE I_INVENTORY ADD                                                     
CONSTRAINT MINVENTORYLINE_IINVENTORY                                            
FOREIGN KEY (                                                                   
M_INVENTORYLINE_ID                                                              
) REFERENCES M_INVENTORYLINE (                                                  
M_INVENTORYLINE_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE I_INVENTORY ADD                                                     
CONSTRAINT MLOCATOR_IINVENTORY                                                  
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_INVENTORY ADD                                                     
CONSTRAINT MPRODUCT_IINVENTORY                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_INVENTORY ADD                                                     
CONSTRAINT MINVENTORY_IINVENTORY                                                
FOREIGN KEY (                                                                   
M_INVENTORY_ID                                                                  
) REFERENCES M_INVENTORY (                                                      
M_INVENTORY_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT ADORG_IINVOICE                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CBPLOCATION_IINVOICE                                                 
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT MPRICELIST_IINVOICE                                                  
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CDOCTYPE_IINVOICE                                                    
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CACTIVITY_IINVOICE                                                   
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CREGION_IINVOICE                                                     
FOREIGN KEY (                                                                   
C_REGION_ID                                                                     
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT ADORGTRX_IINVOICE                                                    
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CTAX_IINVOICE                                                        
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT NPRODUCT_IINVOICE                                                    
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CCAMPAIGN_IINVOICE                                                   
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CCOUNTRY_IINVOICE                                                    
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CCURRENCY_IINVOICE                                                   
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CINVLICELINE_IINVOICE                                                
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CINVOICE_IINVOICE                                                    
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CLOCATION_IINVOICE                                                   
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CPROJECT_IINVOICE                                                    
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT ADUSERSALESREP_IINVOICE                                              
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT ADUSER_IINVOICE                                                      
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CBPARTNER_IINVOICE                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_INVOICE ADD                                                       
CONSTRAINT CPAYMENTTERM_IINVOICE                                                
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT MPRICELIST_IORDER                                                    
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CTAX_IORDER                                                          
FOREIGN KEY (                                                                   
C_TAX_ID                                                                        
) REFERENCES C_TAX (                                                            
C_TAX_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CBPARTNER_IORDER                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT ADUSER_IORDER                                                        
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT MWAREHOUSE_IORDER                                                    
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CDOCTYPE_IORDER                                                      
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CCAMPAIGN_IORDER                                                     
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CCOUNTRY_IORDER                                                      
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CLOCATION_IORDER                                                     
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CORDER_IORDER                                                        
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CCURRENCY_IORDER                                                     
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CREGION_IORDER                                                       
FOREIGN KEY (                                                                   
C_REGION_ID                                                                     
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT MSHIPPER_IORDER                                                      
FOREIGN KEY (                                                                   
M_SHIPPER_ID                                                                    
) REFERENCES M_SHIPPER (                                                        
M_SHIPPER_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CBPARTNERLOCBILLTO_IORDER                                            
FOREIGN KEY (                                                                   
BILLTO_ID                                                                       
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CBOLOCATION_IORDER                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT ADORG_IORDER                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CPAYMENTTERM_IORDER                                                  
FOREIGN KEY (                                                                   
C_PAYMENTTERM_ID                                                                
) REFERENCES C_PAYMENTTERM (                                                    
C_PAYMENTTERM_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CPROJECT_IORDER                                                      
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT ADUSERSALESREP_IORDER                                                
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CACTIVITY_IORDER                                                     
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CORDERLINE_IORDER                                                    
FOREIGN KEY (                                                                   
C_ORDERLINE_ID                                                                  
) REFERENCES C_ORDERLINE (                                                      
C_ORDERLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT MPRODUCT_IORDER                                                      
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT CUOM_IORDER                                                          
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE I_ORDER ADD                                                         
CONSTRAINT ADORGTRX_IORDER                                                      
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE I_PAYMENT ADD                                                       
CONSTRAINT CBPARTNER_IPAYMENT                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_PAYMENT ADD                                                       
CONSTRAINT CPAYMENT_IPAYMENT                                                    
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_PAYMENT ADD                                                       
CONSTRAINT CINVOICE_IPAYMENT                                                    
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_PAYMENT ADD                                                       
CONSTRAINT CBANKACCOUNT_IPAYMENT                                                
FOREIGN KEY (                                                                   
C_BANKACCOUNT_ID                                                                
) REFERENCES C_BANKACCOUNT (                                                    
C_BANKACCOUNT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE I_PAYMENT ADD                                                       
CONSTRAINT CCHARGE_IPAYMENT                                                     
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE I_PAYMENT ADD                                                       
CONSTRAINT CDOCTYPE_IPAYMENT                                                    
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_PRODUCT ADD                                                       
CONSTRAINT CBPARTNER_IPRODUCT                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_PRODUCT ADD                                                       
CONSTRAINT MPRODUCT_IPRODUCT                                                    
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE I_PRODUCT ADD                                                       
CONSTRAINT CCURRENCY_IPRODUCT                                                   
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE I_PRODUCT ADD                                                       
CONSTRAINT MPRODUCTCATEGORY_IPRODUCT                                            
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE I_PRODUCT ADD                                                       
CONSTRAINT CUOM_IPRODUCT                                                        
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE I_REPORTLINE ADD                                                    
CONSTRAINT PAREPORTLINESET_IREPORTLINE                                          
FOREIGN KEY (                                                                   
PA_REPORTLINESET_ID                                                             
) REFERENCES PA_REPORTLINESET (                                                 
PA_REPORTLINESET_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE I_REPORTLINE ADD                                                    
CONSTRAINT CELEMENTVALUE_IREPORTLINE                                            
FOREIGN KEY (                                                                   
C_ELEMENTVALUE_ID                                                               
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE I_REPORTLINE ADD                                                    
CONSTRAINT PAREPORTSOURCE_IREPORTLINE                                           
FOREIGN KEY (                                                                   
PA_REPORTSOURCE_ID                                                              
) REFERENCES PA_REPORTSOURCE (                                                  
PA_REPORTSOURCE_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE I_REPORTLINE ADD                                                    
CONSTRAINT PAREPORTLINE_IREPORTLINE                                             
FOREIGN KEY (                                                                   
PA_REPORTLINE_ID                                                                
) REFERENCES PA_REPORTLINE (                                                    
PA_REPORTLINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE K_CATEGORYVALUE ADD                                                 
CONSTRAINT KCATEGORY_KCATEGORYVALUE                                             
FOREIGN KEY (                                                                   
K_CATEGORY_ID                                                                   
) REFERENCES K_CATEGORY (                                                       
K_CATEGORY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE K_COMMENT ADD                                                       
CONSTRAINT KENTRY_KCOMMENT                                                      
FOREIGN KEY (                                                                   
K_ENTRY_ID                                                                      
) REFERENCES K_ENTRY (                                                          
K_ENTRY_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE K_COMMENT ADD                                                       
CONSTRAINT ADSESSION_KCOMMENT                                                   
FOREIGN KEY (                                                                   
AD_SESSION_ID                                                                   
) REFERENCES AD_SESSION (                                                       
AD_SESSION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE K_ENTRY ADD                                                         
CONSTRAINT KTOPIC_KENTRY                                                        
FOREIGN KEY (                                                                   
K_TOPIC_ID                                                                      
) REFERENCES K_TOPIC (                                                          
K_TOPIC_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE K_ENTRY ADD                                                         
CONSTRAINT ADSESSION_KENTRY                                                     
FOREIGN KEY (                                                                   
AD_SESSION_ID                                                                   
) REFERENCES AD_SESSION (                                                       
AD_SESSION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE K_ENTRY ADD                                                         
CONSTRAINT KSOURCE_KENTRY                                                       
FOREIGN KEY (                                                                   
K_SOURCE_ID                                                                     
) REFERENCES K_SOURCE (                                                         
K_SOURCE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE K_ENTRYCATEGORY ADD                                                 
CONSTRAINT KCATEGORYVALUE_KENTRYCATEGORY                                        
FOREIGN KEY (                                                                   
K_CATEGORYVALUE_ID                                                              
) REFERENCES K_CATEGORYVALUE (                                                  
K_CATEGORYVALUE_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE K_ENTRYCATEGORY ADD                                                 
CONSTRAINT KENTRY_KENTRYCATALOG                                                 
FOREIGN KEY (                                                                   
K_ENTRY_ID                                                                      
) REFERENCES K_ENTRY (                                                          
K_ENTRY_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE K_ENTRYCATEGORY ADD                                                 
CONSTRAINT KCATEGORY_KENTRYCATEGORY                                             
FOREIGN KEY (                                                                   
K_CATEGORY_ID                                                                   
) REFERENCES K_CATEGORY (                                                       
K_CATEGORY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE K_ENTRYRELATED ADD                                                  
CONSTRAINT KENTRY_KENTRYRELATEDID                                               
FOREIGN KEY (                                                                   
K_ENTRYRELATED_ID                                                               
) REFERENCES K_ENTRY (                                                          
K_ENTRY_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE K_ENTRYRELATED ADD                                                  
CONSTRAINT KENTRY_KENTRYRELATED                                                 
FOREIGN KEY (                                                                   
K_ENTRY_ID                                                                      
) REFERENCES K_ENTRY (                                                          
K_ENTRY_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE K_TOPIC ADD                                                         
CONSTRAINT KTYPE_KTOPIC                                                         
FOREIGN KEY (                                                                   
K_TYPE_ID                                                                       
) REFERENCES K_TYPE (                                                           
K_TYPE_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT CACTIVITYMPCCOSTCOLLECTOR                                            
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT SRESOURCEMPCCOSTCOLLECTOR                                            
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT CPROJECTMPCCOSTCOLLECTOR                                             
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT ADORGMPCCOSTCOLLECTOR                                                
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT ADORGTRXMPCCOSTCOLLECTOR                                             
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT CCAMPAIGNMPCCOSTCOLLECTOR                                            
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT CDOCTYPEMPCCOSTCOLLECTOR                                             
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT CELEMENTVALUE1MPCCOSTCOLLECTOR                                       
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT MWAREHOUSEMPCCOSTCOLLECTOR                                           
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT MPRODUCTMPCCOSTCOLLECTOR                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT CELEMENTVALUE2MPCCOSTCOLLECTOR                                       
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT MATTRIBUTESETIMPCCOSTCOLLECTOR                                       
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT MLOCATORMPCCOSTCOLLECTOR                                             
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_COLLECTOR ADD                                              
CONSTRAINT ADCLIENTMPCCOSTCOLLECTOR                                             
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_COST_ELEMENT ADD                                                
CONSTRAINT AD_ORGMPC_COST_ELEMENT                                               
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_COST_ELEMENT ADD                                                
CONSTRAINT AD_CLIENTMPC_COST_ELEMENT                                            
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_COST_ELEMENT_ACCT ADD                                           
CONSTRAINT CACCTSCHEMAMPCCOSTEACCT                                              
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE MPC_COST_ELEMENT_ACCT ADD                                           
CONSTRAINT ADCLIENTMPCCOSTEACCT                                                 
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_COST_ELEMENT_ACCT ADD                                           
CONSTRAINT MPCCOSTELEMENTMPCCOSTEACCT                                           
FOREIGN KEY (                                                                   
MPC_COST_ELEMENT_ID                                                             
) REFERENCES MPC_COST_ELEMENT (                                                 
MPC_COST_ELEMENT_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE MPC_COST_ELEMENT_ACCT ADD                                           
CONSTRAINT ADORGMPCCOSTACCT                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_COST_GROUP ADD                                                  
CONSTRAINT ADCLIENTMPCCOST_GROUP                                                
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_COST_GROUP ADD                                                  
CONSTRAINT AD_ORGMPCCOSTGROUP                                                   
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_MRP ADD                                                         
CONSTRAINT ADCLIENTMPCMRP                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_MRP ADD                                                         
CONSTRAINT AD_ORGMPCMRP                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT ADORGMPCORDER                                                        
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT CPROJECTMPCORDER                                                     
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT CDOCTYPEMPCORDER                                                     
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT CACTIVITYMPCORDER                                                    
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT SRESOURCEMPCORDER                                                    
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT MPCPRODUCTBOMMPCORDER                                                
FOREIGN KEY (                                                                   
MPC_PRODUCT_BOM_ID                                                              
) REFERENCES MPC_PRODUCT_BOM (                                                  
MPC_PRODUCT_BOM_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT CUOMMPCORDER                                                         
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT MATTRIBUTESETIMPCORDER                                               
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT MPRODUCTMPCORDER                                                     
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT MWAREHOUSEMPCORDER                                                   
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT ADORGTRXMPCORDER                                                     
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT CCAMPAIGNMPCORDER                                                    
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT CELEMENTVALUE1MPCORDER                                               
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT ADWORKFLOWMPCORDER                                                   
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT ADCLIENTMPCORDER                                                     
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER ADD                                                       
CONSTRAINT CELEMENTVALUE2MPCORDER                                               
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_BOM ADD                                                   
CONSTRAINT MPRODUCT_MPCORDERBOM                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOM ADD                                                   
CONSTRAINT ADCLIENTMPCORDERBOM                                                  
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOM ADD                                                   
CONSTRAINT ADORGMPCORDERBOM                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOM ADD                                                   
CONSTRAINT MATTRIBUTESETINSTMPCORDERBOM                                         
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT MPCORDERBOMMPCORDERBOMLINE                                           
FOREIGN KEY (                                                                   
MPC_ORDER_BOM_ID                                                                
) REFERENCES MPC_ORDER_BOM (                                                    
MPC_ORDER_BOM_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT CUOMMPCORDERBOMLINE                                                  
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT MATTRSETINSTMPCORDERBOMLINE                                          
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT MLOCATORMPCORDERBOMLINE                                              
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT MWAREHOUSEMPCORDERBOMLINE                                            
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT ADORGMPCORDERBOMLINE                                                 
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT ADCLIENTMPCORDERBOMLINE                                              
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_BOMLINE ADD                                               
CONSTRAINT MPRODUCTMPCORDERBOMLINE                                              
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_COST ADD                                                  
CONSTRAINT ADCLIENTMPCORDERCOST                                                 
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_COST ADD                                                  
CONSTRAINT ADORGMPCORDERCOST                                                    
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_COST ADD                                                  
CONSTRAINT SRESOURCEMPCORDERCOST                                                
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_COST ADD                                                  
CONSTRAINT MWAREHOUSEMPCORDERCOST                                               
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_COST ADD                                                  
CONSTRAINT MPCCOSTELEMENTMPCORDERCOST                                           
FOREIGN KEY (                                                                   
MPC_COST_ELEMENT_ID                                                             
) REFERENCES MPC_COST_ELEMENT (                                                 
MPC_COST_ELEMENT_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_COST ADD                                                  
CONSTRAINT MPRODUCTMPCORDERCOST                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADTASKMPCORDERNODE                                                   
FOREIGN KEY (                                                                   
AD_TASK_ID                                                                      
) REFERENCES AD_TASK (                                                          
AD_TASK_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT SRESOURCEMPCORDERNODE                                                
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT CBPARTNERMPCORDERNODE                                                
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADWFNODEMPCORDERNODE                                                 
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADORGMPCORDERNODE                                                    
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADCLIENTMPCORDERNODE                                                 
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADFORMMPCORDERNODE                                                   
FOREIGN KEY (                                                                   
AD_FORM_ID                                                                      
) REFERENCES AD_FORM (                                                          
AD_FORM_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADWFBLOCKMPCORDERNODE                                                
FOREIGN KEY (                                                                   
AD_WF_BLOCK_ID                                                                  
) REFERENCES AD_WF_BLOCK (                                                      
AD_WF_BLOCK_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADWINDOWMPCORDERNODE                                                 
FOREIGN KEY (                                                                   
AD_WINDOW_ID                                                                    
) REFERENCES AD_WINDOW (                                                        
AD_WINDOW_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADIMAGEMPCORDERNODE                                                  
FOREIGN KEY (                                                                   
AD_IMAGE_ID                                                                     
) REFERENCES AD_IMAGE (                                                         
AD_IMAGE_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT WORKFLOW_MPCORDERNODE                                                
FOREIGN KEY (                                                                   
WORKFLOW_ID                                                                     
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADWORKFLOWMPCORDERNODE                                               
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE ADD                                                  
CONSTRAINT ADPROCESSMPCORDERNODE                                                
FOREIGN KEY (                                                                   
AD_PROCESS_ID                                                                   
) REFERENCES AD_PROCESS (                                                       
AD_PROCESS_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODENEXT ADD                                              
CONSTRAINT ADWFNODEMPCORDENEXT                                                  
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODENEXT ADD                                              
CONSTRAINT ADORGMPCORDENEXT                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODENEXT ADD                                              
CONSTRAINT ADCLIENTMPCORDENEXT                                                  
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_ORDER_NODE_ASSET ADD                                            
CONSTRAINT ADORGMPCORDERNODEASSET                                               
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_NODE_ASSET ADD                                            
CONSTRAINT AASSETMPCORDERNODEASSET                                              
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_NODE_ASSET ADD                                            
CONSTRAINT ADCLIENTMPCORDERNODEASSET                                            
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_NODE_PRODUCT ADD                                          
CONSTRAINT ADORGMPCORDERNODEPRODUCT                                             
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_NODE_PRODUCT ADD                                          
CONSTRAINT M_PRODUCTMPCORDERNODEPRODUCT                                         
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_NODE_PRODUCT ADD                                          
CONSTRAINT ADCLIENTMPCORDERNODEPRODUCT                                          
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_WORKFLOW ADD                                              
CONSTRAINT ADWORKFLOWPROCESSORMPCORDERWF                                        
FOREIGN KEY (                                                                   
AD_WORKFLOWPROCESSOR_ID                                                         
) REFERENCES AD_WORKFLOWPROCESSOR (                                             
AD_WORKFLOWPROCESSOR_ID                                                         
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_WORKFLOW ADD                                              
CONSTRAINT ADWORKFLOWMPCORDERWF                                                 
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_WORKFLOW ADD                                              
CONSTRAINT ADCLIENTMPCORDERWF                                                   
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_WORKFLOW ADD                                              
CONSTRAINT ADORGMPCORDERWF                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_ORDER_WORKFLOW ADD                                              
CONSTRAINT ADTABLEMPCORDERWF                                                    
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_BOM ADD                                                 
CONSTRAINT ADORG_MPCPRODUCTBOM                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOM ADD                                                 
CONSTRAINT CUOM_MPCPRODUCTBOM                                                   
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOM ADD                                                 
CONSTRAINT ADCLIENT_MPCPRODUCTBOM                                               
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOM ADD                                                 
CONSTRAINT MPRODUCT_MPCPRODUCTBOM                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOM ADD                                                 
CONSTRAINT MATTRIBUTESETI_MPCPRODUCTBOM                                         
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOMLINE ADD                                             
CONSTRAINT MATTRIBUTESETI_MPCPRODUCTBOML                                        
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOMLINE ADD                                             
CONSTRAINT MPCPRODUCTBOM_MPCPRODUCTBOML                                         
FOREIGN KEY (                                                                   
MPC_PRODUCT_BOM_ID                                                              
) REFERENCES MPC_PRODUCT_BOM (                                                  
MPC_PRODUCT_BOM_ID                                                              
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOMLINE ADD                                             
CONSTRAINT ADCLIENT_MPCPRODUCTBOML                                              
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOMLINE ADD                                             
CONSTRAINT CUOM_MPCPRODUCTBOML                                                  
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOMLINE ADD                                             
CONSTRAINT MPRODUCT_MPCPRODUCTBOML                                              
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_BOMLINE ADD                                             
CONSTRAINT ADORG_MPCPRODUCTBOML                                                 
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE MPC_PRODUCT_COSTING ADD                                             
CONSTRAINT ADCLIENTMPCPRODDUCTCOSTING                                           
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_COSTING ADD                                             
CONSTRAINT ADORGMPCPRODUCTCOSTING                                               
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_COSTING ADD                                             
CONSTRAINT MPCCOSTEMPCPRODUCTCOSTING                                            
FOREIGN KEY (                                                                   
MPC_COST_ELEMENT_ID                                                             
) REFERENCES MPC_COST_ELEMENT (                                                 
MPC_COST_ELEMENT_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_COSTING ADD                                             
CONSTRAINT CACCTSCHEMAMPCPRODUCTCOSTING                                         
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_COSTING ADD                                             
CONSTRAINT MWAREHOUSEMPCPRODUCTCOSTING                                          
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_COSTING ADD                                             
CONSTRAINT MPCCOSTGROUPMPCPRODUCTCOSTING                                        
FOREIGN KEY (                                                                   
MPC_COST_GROUP_ID                                                               
) REFERENCES MPC_COST_GROUP (                                                   
MPC_COST_GROUP_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_COSTING ADD                                             
CONSTRAINT MPRODUCTMPCPRODUCTCOSTING                                            
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_PLANNING ADD                                            
CONSTRAINT SRESOURCEMPCPRODUCTPLANNING                                          
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_PLANNING ADD                                            
CONSTRAINT MPRODUCTMPCPRODUCTPLANNING                                           
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_PLANNING ADD                                            
CONSTRAINT ADCLIENTMPCPRODDUCTPLANNING                                          
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_PLANNING ADD                                            
CONSTRAINT MWAREHOUSEMPCPRODUCTPLANNING                                         
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_PRODUCT_PLANNING ADD                                            
CONSTRAINT ADORGMPCPRODUCTPLANNING                                              
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_PROFILEBOM ADD                                                  
CONSTRAINT ADORG_MPCPROFILEBOM                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_PROFILEBOM ADD                                                  
CONSTRAINT ADCLIENT_MPCPROFILEBOM                                               
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT PLANNER_IDMPCSCHEDULE                                                
FOREIGN KEY (                                                                   
PLANNER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT CACTIVITYMPCSCHEDULE                                                 
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT SRESOURCEMPCSCHEDULE                                                 
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT CELEMENTVALUE1MPCSCHEDULE                                            
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT AD_ORGMPCSCHEDULE                                                    
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT MWAREHOUSEMPCSCHEDULE                                                
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT ADCLIENTMPCSCHEDULE                                                  
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT ADORGTRXMPCSCHEDULE                                                  
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT CCAMPAIGNMPCSCHEDULE                                                 
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT CELEMENTVALUE2MPCSCHEDULE                                            
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE MPC_SCHEDULE ADD                                                    
CONSTRAINT ADORGMPCSCHEDULE                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_ASSET ADD                                               
CONSTRAINT ADWORKFLOWMPCWFNODENODEASSET                                         
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_ASSET ADD                                               
CONSTRAINT ADWFNODEMPCWFNODEASSET                                               
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_ASSET ADD                                               
CONSTRAINT ADORGMPCWFNODEASSET                                                  
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_ASSET ADD                                               
CONSTRAINT ADCLIENTMPCWFNODENODEASSET                                           
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_ASSET ADD                                               
CONSTRAINT AASSETMPCWFNODEASSET                                                 
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_PRODUCT ADD                                             
CONSTRAINT M_PRODUCTMPCWFNODEPRODUCT                                            
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_PRODUCT ADD                                             
CONSTRAINT ADWORKFLOWMPCWFNODEPRODUCT                                           
FOREIGN KEY (                                                                   
AD_WORKFLOW_ID                                                                  
) REFERENCES AD_WORKFLOW (                                                      
AD_WORKFLOW_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_PRODUCT ADD                                             
CONSTRAINT ADWFNODEMPCWFNODEPRODUCT                                             
FOREIGN KEY (                                                                   
AD_WF_NODE_ID                                                                   
) REFERENCES AD_WF_NODE (                                                       
AD_WF_NODE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_PRODUCT ADD                                             
CONSTRAINT ADORGMPCWFNODEPRODUCT                                                
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE MPC_WF_NODE_PRODUCT ADD                                             
CONSTRAINT ADCLIENTMPCWFNODEPRODUCT                                             
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTE ADD                                                     
CONSTRAINT MATTRIBUTESEARCH_MATTRIBUTE                                          
FOREIGN KEY (                                                                   
M_ATTRIBUTESEARCH_ID                                                            
) REFERENCES M_ATTRIBUTESEARCH (                                                
M_ATTRIBUTESEARCH_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTEINSTANCE ADD                                             
CONSTRAINT MATTRSETINST__MATTRINST                                              
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_ATTRIBUTEINSTANCE ADD                                             
CONSTRAINT MATTRIBUTEVALUE_MATTRINST                                            
FOREIGN KEY (                                                                   
M_ATTRIBUTEVALUE_ID                                                             
) REFERENCES M_ATTRIBUTEVALUE (                                                 
M_ATTRIBUTEVALUE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTEINSTANCE ADD                                             
CONSTRAINT MATTRIBUTE_MATTRIBUTEINST                                            
FOREIGN KEY (                                                                   
M_ATTRIBUTE_ID                                                                  
) REFERENCES M_ATTRIBUTE (                                                      
M_ATTRIBUTE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTESET ADD                                                  
CONSTRAINT MSERNOCTL_ATTRIBUTESET                                               
FOREIGN KEY (                                                                   
M_SERNOCTL_ID                                                                   
) REFERENCES M_SERNOCTL (                                                       
M_SERNOCTL_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTESET ADD                                                  
CONSTRAINT MLOTCTL_MATTRIBUTESET                                                
FOREIGN KEY (                                                                   
M_LOTCTL_ID                                                                     
) REFERENCES M_LOTCTL (                                                         
M_LOTCTL_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTESETINSTANCE ADD                                          
CONSTRAINT MLOT_MATTRIBUTESETINSTANCE                                           
FOREIGN KEY (                                                                   
M_LOT_ID                                                                        
) REFERENCES M_LOT (                                                            
M_LOT_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTESETINSTANCE ADD                                          
CONSTRAINT MATTRIBUTESET_MATTRIBSETINST                                         
FOREIGN KEY (                                                                   
M_ATTRIBUTESET_ID                                                               
) REFERENCES M_ATTRIBUTESET (                                                   
M_ATTRIBUTESET_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTEUSE ADD                                                  
CONSTRAINT MATTRIBUTE_MATTRIBUTEUSE                                             
FOREIGN KEY (                                                                   
M_ATTRIBUTE_ID                                                                  
) REFERENCES M_ATTRIBUTE (                                                      
M_ATTRIBUTE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTEUSE ADD                                                  
CONSTRAINT MATTRIBUTESET_MATTRIBUTEUSE                                          
FOREIGN KEY (                                                                   
M_ATTRIBUTESET_ID                                                               
) REFERENCES M_ATTRIBUTESET (                                                   
M_ATTRIBUTESET_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_ATTRIBUTEVALUE ADD                                                
CONSTRAINT MATTRIBUTE_MATTRIBUTEVALUE                                           
FOREIGN KEY (                                                                   
M_ATTRIBUTE_ID                                                                  
) REFERENCES M_ATTRIBUTE (                                                      
M_ATTRIBUTE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_BOM ADD                                                           
CONSTRAINT MCN_MBOM                                                             
FOREIGN KEY (                                                                   
M_CHANGENOTICE_ID                                                               
) REFERENCES M_CHANGENOTICE (                                                   
M_CHANGENOTICE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_BOM ADD                                                           
CONSTRAINT MPRODUCT_MBOM                                                        
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_BOMALTERNATIVE ADD                                                
CONSTRAINT MPRODUCT_MBOMALTERNATIVE                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_BOMPRODUCT ADD                                                    
CONSTRAINT MPRODUCT_MBOMPRODUCT                                                 
FOREIGN KEY (                                                                   
M_PRODUCTBOM_ID                                                                 
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_BOMPRODUCT ADD                                                    
CONSTRAINT MBOMALTERNATIVE_MBOMPRODUCT                                          
FOREIGN KEY (                                                                   
M_BOMALTERNATIVE_ID                                                             
) REFERENCES M_BOMALTERNATIVE (                                                 
M_BOMALTERNATIVE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE M_BOMPRODUCT ADD                                                    
CONSTRAINT MPRODUCTOP_MBOMPRODUCT                                               
FOREIGN KEY (                                                                   
M_PRODUCTOPERATION_ID                                                           
) REFERENCES M_PRODUCTOPERATION (                                               
M_PRODUCTOPERATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_BOMPRODUCT ADD                                                    
CONSTRAINT MCN_MBOMPRODUCT                                                      
FOREIGN KEY (                                                                   
M_CHANGENOTICE_ID                                                               
) REFERENCES M_CHANGENOTICE (                                                   
M_CHANGENOTICE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_BOMPRODUCT ADD                                                    
CONSTRAINT MBOM_MBOMPRODUCT                                                     
FOREIGN KEY (                                                                   
M_BOM_ID                                                                        
) REFERENCES M_BOM (                                                            
M_BOM_ID                                                                        
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_BOMPRODUCT ADD                                                    
CONSTRAINT MASI_MBOMPRODUCT                                                     
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_CHANGEREQUEST ADD                                                 
CONSTRAINT MCN_MCR                                                              
FOREIGN KEY (                                                                   
M_CHANGENOTICE_ID                                                               
) REFERENCES M_CHANGENOTICE (                                                   
M_CHANGENOTICE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_CHANGEREQUEST ADD                                                 
CONSTRAINT MBOM_MCHANGEREQUEST                                                  
FOREIGN KEY (                                                                   
M_BOM_ID                                                                        
) REFERENCES M_BOM (                                                            
M_BOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE M_COST ADD                                                          
CONSTRAINT ADCLIENT_MCOST                                                       
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_COST ADD                                                          
CONSTRAINT ADORG_M_COST                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_COST ADD                                                          
CONSTRAINT MCOSTTYPE_MCOST                                                      
FOREIGN KEY (                                                                   
M_COSTTYPE_ID                                                                   
) REFERENCES M_COSTTYPE (                                                       
M_COSTTYPE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_COST ADD                                                          
CONSTRAINT MPRODUCT_MCOST                                                       
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_COST ADD                                                          
CONSTRAINT MCOSTELEMENT_MCOST                                                   
FOREIGN KEY (                                                                   
M_COSTELEMENT_ID                                                                
) REFERENCES M_COSTELEMENT (                                                    
M_COSTELEMENT_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE M_COST ADD                                                          
CONSTRAINT CACCTSCHEMA_MCOST                                                    
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DEMAND ADD                                                        
CONSTRAINT CYEAR_MDEMAND                                                        
FOREIGN KEY (                                                                   
C_YEAR_ID                                                                       
) REFERENCES C_YEAR (                                                           
C_YEAR_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_DEMAND ADD                                                        
CONSTRAINT CCALENDAR_MDEMAND                                                    
FOREIGN KEY (                                                                   
C_CALENDAR_ID                                                                   
) REFERENCES C_CALENDAR (                                                       
C_CALENDAR_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_DEMANDDETAIL ADD                                                  
CONSTRAINT MFORECASTLINE_MDEMANDDETAIL                                          
FOREIGN KEY (                                                                   
M_FORECASTLINE_ID                                                               
) REFERENCES M_FORECASTLINE (                                                   
M_FORECASTLINE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DEMANDDETAIL ADD                                                  
CONSTRAINT MDEMANDLINE_MDEMANDDETAIL                                            
FOREIGN KEY (                                                                   
M_DEMANDLINE_ID                                                                 
) REFERENCES M_DEMANDLINE (                                                     
M_DEMANDLINE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DEMANDDETAIL ADD                                                  
CONSTRAINT MREQLINE_MDEMANDDETAIL                                               
FOREIGN KEY (                                                                   
M_REQUISITIONLINE_ID                                                            
) REFERENCES M_REQUISITIONLINE (                                                
M_REQUISITIONLINE_ID                                                            
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DEMANDDETAIL ADD                                                  
CONSTRAINT CORDERLINE_MDEMANDDETAIL                                             
FOREIGN KEY (                                                                   
C_ORDERLINE_ID                                                                  
) REFERENCES C_ORDERLINE (                                                      
C_ORDERLINE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DEMANDLINE ADD                                                    
CONSTRAINT CPERIOD_MDEMANDLINE                                                  
FOREIGN KEY (                                                                   
C_PERIOD_ID                                                                     
) REFERENCES C_PERIOD (                                                         
C_PERIOD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_DEMANDLINE ADD                                                    
CONSTRAINT MDEMAND_MDEMANDLINE                                                  
FOREIGN KEY (                                                                   
M_DEMAND_ID                                                                     
) REFERENCES M_DEMAND (                                                         
M_DEMAND_ID                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DEMANDLINE ADD                                                    
CONSTRAINT MPRODUCT_MDEMANDLINE                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DISCOUNTSCHEMABREAK ADD                                           
CONSTRAINT MDISCOUNTS_MDSBREAK                                                  
FOREIGN KEY (                                                                   
M_DISCOUNTSCHEMA_ID                                                             
) REFERENCES M_DISCOUNTSCHEMA (                                                 
M_DISCOUNTSCHEMA_ID                                                             
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DISCOUNTSCHEMABREAK ADD                                           
CONSTRAINT MPRODCATEGORY_MDISCOUNTSBREAK                                        
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_DISCOUNTSCHEMABREAK ADD                                           
CONSTRAINT MPRODUCT_MDISCOUNTSBREAK                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_DISCOUNTSCHEMALINE ADD                                            
CONSTRAINT MDISCOUNTSCHEMA_MDSLINE                                              
FOREIGN KEY (                                                                   
M_DISCOUNTSCHEMA_ID                                                             
) REFERENCES M_DISCOUNTSCHEMA (                                                 
M_DISCOUNTSCHEMA_ID                                                             
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DISCOUNTSCHEMALINE ADD                                            
CONSTRAINT MPRODUCT_MDISCOUNTSLINE                                              
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_DISCOUNTSCHEMALINE ADD                                            
CONSTRAINT CCONVERSIONTYPE_MDISCSCHLINE                                         
FOREIGN KEY (                                                                   
C_CONVERSIONTYPE_ID                                                             
) REFERENCES C_CONVERSIONTYPE (                                                 
C_CONVERSIONTYPE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE M_DISCOUNTSCHEMALINE ADD                                            
CONSTRAINT MPRODCATEGORY_MDISCOUNTSLINE                                         
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_DISCOUNTSCHEMALINE ADD                                            
CONSTRAINT CBPARTNER_MDISCOUNTSLINE                                             
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_DISTRIBUTIONLISTLINE ADD                                          
CONSTRAINT MDISTRIBUTIONLIST_LINE                                               
FOREIGN KEY (                                                                   
M_DISTRIBUTIONLIST_ID                                                           
) REFERENCES M_DISTRIBUTIONLIST (                                               
M_DISTRIBUTIONLIST_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DISTRIBUTIONLISTLINE ADD                                          
CONSTRAINT CBPARTNERLOC_MDISTLISTLINE                                           
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE M_DISTRIBUTIONLISTLINE ADD                                          
CONSTRAINT CBPARTNER_MDISTLISTLINE                                              
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_DISTRIBUTIONRUN ADD                                               
CONSTRAINT CBPLOCATION_MDISTRIBUTIONRUN                                         
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE M_DISTRIBUTIONRUN ADD                                               
CONSTRAINT CBPARTNER_MDISTRIBUTIONRUN                                           
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_DISTRIBUTIONRUNLINE ADD                                           
CONSTRAINT MPRODUCT_MDISTRIBUTIONRUN                                            
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_DISTRIBUTIONRUNLINE ADD                                           
CONSTRAINT MDISTRIBUTIONRUN_LINE                                                
FOREIGN KEY (                                                                   
M_DISTRIBUTIONRUN_ID                                                            
) REFERENCES M_DISTRIBUTIONRUN (                                                
M_DISTRIBUTIONRUN_ID                                                            
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_DISTRIBUTIONRUNLINE ADD                                           
CONSTRAINT MDISTRIBUTIONLIST_RUNLINE                                            
FOREIGN KEY (                                                                   
M_DISTRIBUTIONLIST_ID                                                           
) REFERENCES M_DISTRIBUTIONLIST (                                               
M_DISTRIBUTIONLIST_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_EDI ADD                                                           
CONSTRAINT CBPEDI_MEDI                                                          
FOREIGN KEY (                                                                   
C_BP_EDI_ID                                                                     
) REFERENCES C_BP_EDI (                                                         
C_BP_EDI_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_EDI ADD                                                           
CONSTRAINT MWAREHOUSE_MEDI                                                      
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_EDI ADD                                                           
CONSTRAINT MPRODUCT_MEDI                                                        
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_EDI_INFO ADD                                                      
CONSTRAINT MEDI_EDIINFO                                                         
FOREIGN KEY (                                                                   
M_EDI_ID                                                                        
) REFERENCES M_EDI (                                                            
M_EDI_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE M_FORECAST ADD                                                      
CONSTRAINT CYEAR_MFORECAST                                                      
FOREIGN KEY (                                                                   
C_YEAR_ID                                                                       
) REFERENCES C_YEAR (                                                           
C_YEAR_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_FORECAST ADD                                                      
CONSTRAINT CCALENDAR_MFORECAST                                                  
FOREIGN KEY (                                                                   
C_CALENDAR_ID                                                                   
) REFERENCES C_CALENDAR (                                                       
C_CALENDAR_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_FORECASTLINE ADD                                                  
CONSTRAINT CPERIOD_MFORECASTLINE                                                
FOREIGN KEY (                                                                   
C_PERIOD_ID                                                                     
) REFERENCES C_PERIOD (                                                         
C_PERIOD_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_FORECASTLINE ADD                                                  
CONSTRAINT MPRODUCT_MFORECASTLINE                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_FORECASTLINE ADD                                                  
CONSTRAINT MFORECAST_MFORECASTLINE                                              
FOREIGN KEY (                                                                   
M_FORECAST_ID                                                                   
) REFERENCES M_FORECAST (                                                       
M_FORECAST_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_FREIGHT ADD                                                       
CONSTRAINT CREGIONTO_MFREIGHT                                                   
FOREIGN KEY (                                                                   
TO_REGION_ID                                                                    
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_FREIGHT ADD                                                       
CONSTRAINT MSHIPPER_MFREIGHT                                                    
FOREIGN KEY (                                                                   
M_SHIPPER_ID                                                                    
) REFERENCES M_SHIPPER (                                                        
M_SHIPPER_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_FREIGHT ADD                                                       
CONSTRAINT CREGION_MFREIGHT                                                     
FOREIGN KEY (                                                                   
C_REGION_ID                                                                     
) REFERENCES C_REGION (                                                         
C_REGION_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_FREIGHT ADD                                                       
CONSTRAINT MFREIGHTCATEGORY_MFREIGHT                                            
FOREIGN KEY (                                                                   
M_FREIGHTCATEGORY_ID                                                            
) REFERENCES M_FREIGHTCATEGORY (                                                
M_FREIGHTCATEGORY_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE M_FREIGHT ADD                                                       
CONSTRAINT CCOUNTRYTO_MFREIGHT                                                  
FOREIGN KEY (                                                                   
TO_COUNTRY_ID                                                                   
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_FREIGHT ADD                                                       
CONSTRAINT CCURRENCY_MFREIGHT                                                   
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_FREIGHT ADD                                                       
CONSTRAINT CCOUNTRY_MFREIGHT                                                    
FOREIGN KEY (                                                                   
C_COUNTRY_ID                                                                    
) REFERENCES C_COUNTRY (                                                        
C_COUNTRY_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CDOCTYPE_MINOUT                                                      
FOREIGN KEY (                                                                   
C_DOCTYPE_ID                                                                    
) REFERENCES C_DOCTYPE (                                                        
C_DOCTYPE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT ADORGTRX_MINOUT                                                      
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CBPARTNER_MINOUT                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT ADUSER_SR_MINOUT                                                     
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT ADORG_MINOUT                                                         
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT MSHIPPER_MINOUT                                                      
FOREIGN KEY (                                                                   
M_SHIPPER_ID                                                                    
) REFERENCES M_SHIPPER (                                                        
M_SHIPPER_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT MWAREHOUSE_MINOUT                                                    
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT VBPLOCATION_MINOUT                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CCAMPAIGN_MINOUT                                                     
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CCHARGE_MINOUT                                                       
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CELEMENTVALUEUSER1_MINOUT                                            
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CORDER_MINOUT                                                        
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CPROJECT_MINOUT                                                      
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT ADUSER_MINOUT                                                        
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CACTIVITY_MINOUT                                                     
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT CELEMENTVALUEUSER2_MINOUT                                            
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_INOUT ADD                                                         
CONSTRAINT MINOUT_REF                                                           
FOREIGN KEY (                                                                   
REF_INOUT_ID                                                                    
) REFERENCES M_INOUT (                                                          
M_INOUT_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE M_INOUTCONFIRM ADD                                                  
CONSTRAINT MINOUT_MINOUTCONFIRM                                                 
FOREIGN KEY (                                                                   
M_INOUT_ID                                                                      
) REFERENCES M_INOUT (                                                          
M_INOUT_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_INOUTLINE ADD                                                     
CONSTRAINT MLOCATOR_MINOUTLINE                                                  
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INOUTLINE ADD                                                     
CONSTRAINT MATTRSETINST_MINOUTLINE                                              
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_INOUTLINE ADD                                                     
CONSTRAINT MINOUTLINE_REF                                                       
FOREIGN KEY (                                                                   
REF_INOUTLINE_ID                                                                
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_INOUTLINE ADD                                                     
CONSTRAINT CUOM_MINOUTLINE                                                      
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE M_INOUTLINE ADD                                                     
CONSTRAINT MPRODUCT_MINOUTLINE                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INOUTLINE ADD                                                     
CONSTRAINT MINOUT_MINOUTLINE                                                    
FOREIGN KEY (                                                                   
M_INOUT_ID                                                                      
) REFERENCES M_INOUT (                                                          
M_INOUT_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_INOUTLINE ADD                                                     
CONSTRAINT CORDERLINE_MINOUT                                                    
FOREIGN KEY (                                                                   
C_ORDERLINE_ID                                                                  
) REFERENCES C_ORDERLINE (                                                      
C_ORDERLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_INOUTLINECONFIRM ADD                                              
CONSTRAINT MINOUTLINE_MINOUTCONFIRM                                             
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_INOUTLINECONFIRM ADD                                              
CONSTRAINT MINOUTCONFIRM_MINOUTLINECONF                                         
FOREIGN KEY (                                                                   
M_INOUTCONFIRM_ID                                                               
) REFERENCES M_INOUTCONFIRM (                                                   
M_INOUTCONFIRM_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_INOUTLINEMA ADD                                                   
CONSTRAINT MASI_MINOURLINEMA                                                    
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_INOUTLINEMA ADD                                                   
CONSTRAINT MINOUTLINE_MINOUTLINEMA                                              
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT CCAMPAIGN_MINVENTORY                                                 
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT CELEMENTVALUEUSER1_MINVENT                                           
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT ADORG_MINVENTORY                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT CACTIVITY_MINVENTORY                                                 
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT CELEMENTVALUEUSER2_MINVENT                                           
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT MWAREHOUSE_MINVENTORY                                                
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT MPERPETUALINV_MINVENTORY                                             
FOREIGN KEY (                                                                   
M_PERPETUALINV_ID                                                               
) REFERENCES M_PERPETUALINV (                                                   
M_PERPETUALINV_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT CPROJECT_MINVENTORY                                                  
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORY ADD                                                     
CONSTRAINT ADORGTRX_MINVENTORY                                                  
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORYLINE ADD                                                 
CONSTRAINT MPRODUCT_MINVENTORYLINE                                              
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORYLINE ADD                                                 
CONSTRAINT CCHARGE_MINVENTORYLINE                                               
FOREIGN KEY (                                                                   
C_CHARGE_ID                                                                     
) REFERENCES C_CHARGE (                                                         
C_CHARGE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORYLINE ADD                                                 
CONSTRAINT MATTRSETINST_MINVENTORYLINE                                          
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORYLINE ADD                                                 
CONSTRAINT MLOCATOR_MINVENTORYLINE                                              
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_INVENTORYLINE ADD                                                 
CONSTRAINT MINVENTORY_MINVENTORYLINE                                            
FOREIGN KEY (                                                                   
M_INVENTORY_ID                                                                  
) REFERENCES M_INVENTORY (                                                      
M_INVENTORY_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_INVENTORYLINEMA ADD                                               
CONSTRAINT MASI_MINVENTORYLINEMA                                                
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_INVENTORYLINEMA ADD                                               
CONSTRAINT MINVENTORYLINE_MILINEMA                                              
FOREIGN KEY (                                                                   
M_INVENTORYLINE_ID                                                              
) REFERENCES M_INVENTORYLINE (                                                  
M_INVENTORYLINE_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE M_LOCATOR ADD                                                       
CONSTRAINT M_WAREHOUSE_LOCATOR                                                  
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_LOCATOR ADD                                                       
CONSTRAINT M_WH_LOCATOR_ORG                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_LOCATOR ADD                                                       
CONSTRAINT M_WH_LOCATOR_CLIENT                                                  
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_LOT ADD                                                           
CONSTRAINT MPRODUCT_MLOT                                                        
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_LOT ADD                                                           
CONSTRAINT MLOTCTL_MLOT                                                         
FOREIGN KEY (                                                                   
M_LOTCTL_ID                                                                     
) REFERENCES M_LOTCTL (                                                         
M_LOTCTL_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_MATCHINV ADD                                                      
CONSTRAINT MPRODUCT_MMATCHINV                                                   
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_MATCHINV ADD                                                      
CONSTRAINT CONVOICELINE_MMATCHINV                                               
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE M_MATCHINV ADD                                                      
CONSTRAINT MINOUTLINE_MMATCHINV                                                 
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_MATCHPO ADD                                                       
CONSTRAINT MINOUTLINE_MMATCHPO                                                  
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_MATCHPO ADD                                                       
CONSTRAINT MPRODUCT_MMATCHPO                                                    
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_MATCHPO ADD                                                       
CONSTRAINT CINVOICELINE_MMATCHPO                                                
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE M_MATCHPO ADD                                                       
CONSTRAINT CORDERLINE_MMATCHPO                                                  
FOREIGN KEY (                                                                   
C_ORDERLINE_ID                                                                  
) REFERENCES C_ORDERLINE (                                                      
C_ORDERLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENT ADD                                                      
CONSTRAINT CELEMENTVALUEUSER1_MMOVE                                             
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENT ADD                                                      
CONSTRAINT CELEMENTVALUEUSER2_MMOVE                                             
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENT ADD                                                      
CONSTRAINT CACTIVITY_MMOVEMENT                                                  
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENT ADD                                                      
CONSTRAINT ADORG_MMOVEMENT                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENT ADD                                                      
CONSTRAINT ADORGTRX_MMOVEMENT                                                   
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENT ADD                                                      
CONSTRAINT CCAMPAIGN_MMOVEMENT                                                  
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENT ADD                                                      
CONSTRAINT CPROJECT_MMOVEMENT                                                   
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENTCONFIRM ADD                                               
CONSTRAINT MMOVEMENT_MMOVEMENTCONFIRM                                           
FOREIGN KEY (                                                                   
M_MOVEMENT_ID                                                                   
) REFERENCES M_MOVEMENT (                                                       
M_MOVEMENT_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_MOVEMENTCONFIRM ADD                                               
CONSTRAINT MINVENTORY_MMOVCONFIRM                                               
FOREIGN KEY (                                                                   
M_INVENTORY_ID                                                                  
) REFERENCES M_INVENTORY (                                                      
M_INVENTORY_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENTLINE ADD                                                  
CONSTRAINT MLOCATORTO_MMOVEMENTLINE                                             
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENTLINE ADD                                                  
CONSTRAINT MPRODUCT_MMOVEMENTLINE                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENTLINE ADD                                                  
CONSTRAINT MMOVEMENT_MMOVEMENTLINE                                              
FOREIGN KEY (                                                                   
M_MOVEMENT_ID                                                                   
) REFERENCES M_MOVEMENT (                                                       
M_MOVEMENT_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_MOVEMENTLINE ADD                                                  
CONSTRAINT MATTRSETINST_MMOVEMENTLINE                                           
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENTLINE ADD                                                  
CONSTRAINT MLOCATOR_MOVEMENTLINE                                                
FOREIGN KEY (                                                                   
M_LOCATORTO_ID                                                                  
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENTLINECONFIRM ADD                                           
CONSTRAINT MMOVEMENTCONFIRM_MMOVLINECONF                                        
FOREIGN KEY (                                                                   
M_MOVEMENTCONFIRM_ID                                                            
) REFERENCES M_MOVEMENTCONFIRM (                                                
M_MOVEMENTCONFIRM_ID                                                            
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_MOVEMENTLINECONFIRM ADD                                           
CONSTRAINT MINVENTORYLINE_MMOVLINECONFIRM                                       
FOREIGN KEY (                                                                   
M_INVENTORYLINE_ID                                                              
) REFERENCES M_INVENTORYLINE (                                                  
M_INVENTORYLINE_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE M_MOVEMENTLINECONFIRM ADD                                           
CONSTRAINT MMOVEMENTLINE_MMOVLINECONFIRM                                        
FOREIGN KEY (                                                                   
M_MOVEMENTLINE_ID                                                               
) REFERENCES M_MOVEMENTLINE (                                                   
M_MOVEMENTLINE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_MOVEMENTLINEMA ADD                                                
CONSTRAINT MASI_MMOVEMENTLINEMA                                                 
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_MOVEMENTLINEMA ADD                                                
CONSTRAINT MMOVEMENTLINE_MMOVEMENTLINEMA                                        
FOREIGN KEY (                                                                   
M_MOVEMENTLINE_ID                                                               
) REFERENCES M_MOVEMENTLINE (                                                   
M_MOVEMENTLINE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_OPERATIONRESOURCE ADD                                             
CONSTRAINT AASSET_MOPERATIONRESOURCE                                            
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE M_OPERATIONRESOURCE ADD                                             
CONSTRAINT CJOB_MOPERATIONRESOURCE                                              
FOREIGN KEY (                                                                   
C_JOB_ID                                                                        
) REFERENCES C_JOB (                                                            
C_JOB_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE M_OPERATIONRESOURCE ADD                                             
CONSTRAINT MPRODUCTOP_MOPRESOURCE                                               
FOREIGN KEY (                                                                   
M_PRODUCTOPERATION_ID                                                           
) REFERENCES M_PRODUCTOPERATION (                                               
M_PRODUCTOPERATION_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PACKAGE ADD                                                       
CONSTRAINT MSHIPPER_MPACKAGE                                                    
FOREIGN KEY (                                                                   
M_SHIPPER_ID                                                                    
) REFERENCES M_SHIPPER (                                                        
M_SHIPPER_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PACKAGE ADD                                                       
CONSTRAINT MINOUT_MPACKAGE                                                      
FOREIGN KEY (                                                                   
M_INOUT_ID                                                                      
) REFERENCES M_INOUT (                                                          
M_INOUT_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE M_PACKAGELINE ADD                                                   
CONSTRAINT MPACKAGE_MPACKAGELINE                                                
FOREIGN KEY (                                                                   
M_PACKAGE_ID                                                                    
) REFERENCES M_PACKAGE (                                                        
M_PACKAGE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PACKAGELINE ADD                                                   
CONSTRAINT MINOUTLINE_MPACKAGELINE                                              
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_PERPETUALINV ADD                                                  
CONSTRAINT MPRODCATEGORY_MPERPETUALINV                                          
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PERPETUALINV ADD                                                  
CONSTRAINT MWAREHOUSE_MPERPETUALINV                                             
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_PRICELIST ADD                                                     
CONSTRAINT CCURRENCY_MPRICELIST                                                 
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_PRICELIST ADD                                                     
CONSTRAINT BASEPRICELIST                                                        
FOREIGN KEY (                                                                   
BASEPRICELIST_ID                                                                
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_PRICELIST_VERSION ADD                                             
CONSTRAINT MDISCOUNTS_MPLVERSION                                                
FOREIGN KEY (                                                                   
M_DISCOUNTSCHEMA_ID                                                             
) REFERENCES M_DISCOUNTSCHEMA (                                                 
M_DISCOUNTSCHEMA_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE M_PRICELIST_VERSION ADD                                             
CONSTRAINT MPRICELIST_MPRICELISTVERSION                                         
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT MLOCATOR_MPRODUCT                                                    
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT RMAILTEXT_MPRODUCT                                                   
FOREIGN KEY (                                                                   
R_MAILTEXT_ID                                                                   
) REFERENCES R_MAILTEXT (                                                       
R_MAILTEXT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT MATTRIBUTESET_MPRODUCT                                               
FOREIGN KEY (                                                                   
M_ATTRIBUTESET_ID                                                               
) REFERENCES M_ATTRIBUTESET (                                                   
M_ATTRIBUTESET_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT CTAXCATEGORY_MPRODUCT                                                
FOREIGN KEY (                                                                   
C_TAXCATEGORY_ID                                                                
) REFERENCES C_TAXCATEGORY (                                                    
C_TAXCATEGORY_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT CREVRECOGNITION_MPRODUCT                                             
FOREIGN KEY (                                                                   
C_REVENUERECOGNITION_ID                                                         
) REFERENCES C_REVENUERECOGNITION (                                             
C_REVENUERECOGNITION_ID                                                         
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT MFREIGHTCATEGORY_MPRODUCT                                            
FOREIGN KEY (                                                                   
M_FREIGHTCATEGORY_ID                                                            
) REFERENCES M_FREIGHTCATEGORY (                                                
M_FREIGHTCATEGORY_ID                                                            
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT AD_ORG_MPRODUCT                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT CSUBSCRIPTIONTYPE_MPRODUCT                                           
FOREIGN KEY (                                                                   
C_SUBSCRIPTIONTYPE_ID                                                           
) REFERENCES C_SUBSCRIPTIONTYPE (                                               
C_SUBSCRIPTIONTYPE_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT CUOM_MPRODUCT                                                        
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT MATTRSETINST_MPRODUCT                                                
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT SEXPENSETYPE_MPRODUCT                                                
FOREIGN KEY (                                                                   
S_EXPENSETYPE_ID                                                                
) REFERENCES S_EXPENSETYPE (                                                    
S_EXPENSETYPE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT MPRODUCT_MPRODUCTCATEGORY                                            
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT SRESOURCE_MPRODUCT                                                   
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT ADD                                                       
CONSTRAINT ADCLIENT_MPRODUCT                                                    
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTDOWNLOAD ADD                                               
CONSTRAINT MPRODUCT_MPRODUCTDOWNLOAD                                            
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTION ADD                                                    
CONSTRAINT CACTIVITY_MPRODUCTION                                                
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTION ADD                                                    
CONSTRAINT ADORG_MPRODUCTION                                                    
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTION ADD                                                    
CONSTRAINT CPROJECT_MPRODUCTION                                                 
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTION ADD                                                    
CONSTRAINT CCAMPAIGN_MPRODUCTION                                                
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTION ADD                                                    
CONSTRAINT CELEMENTVALUEUSER1_MPROD                                             
FOREIGN KEY (                                                                   
USER1_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTION ADD                                                    
CONSTRAINT CELEMENTVALUEUSER2_MPROD                                             
FOREIGN KEY (                                                                   
USER2_ID                                                                        
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTION ADD                                                    
CONSTRAINT ADORGTRX_MPRODUCTION                                                 
FOREIGN KEY (                                                                   
AD_ORGTRX_ID                                                                    
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTIONLINE ADD                                                
CONSTRAINT MPRODUCT_MPRODUCTIONLINE                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTIONLINE ADD                                                
CONSTRAINT MLOCATOR_MPRODUCTIONLINE                                             
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTIONLINE ADD                                                
CONSTRAINT MPRODUCTIONPLAN_LINE                                                 
FOREIGN KEY (                                                                   
M_PRODUCTIONPLAN_ID                                                             
) REFERENCES M_PRODUCTIONPLAN (                                                 
M_PRODUCTIONPLAN_ID                                                             
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCTIONLINE ADD                                                
CONSTRAINT MATTRSETINST_MPRODUCTIONLINE                                         
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTIONLINEMA ADD                                              
CONSTRAINT MASI_MPRODUCTIONLINEMA                                               
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCTIONLINEMA ADD                                              
CONSTRAINT MPRODUCTIONLINE_MPLINEMA                                             
FOREIGN KEY (                                                                   
M_PRODUCTIONLINE_ID                                                             
) REFERENCES M_PRODUCTIONLINE (                                                 
M_PRODUCTIONLINE_ID                                                             
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCTIONPLAN ADD                                                
CONSTRAINT MLOCATOR_MPRODUCTIONPLAN                                             
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTIONPLAN ADD                                                
CONSTRAINT MPRODUCT_MPRODUCTIONPLAN                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCTIONPLAN ADD                                                
CONSTRAINT MPRODUCTION_PLAN                                                     
FOREIGN KEY (                                                                   
M_PRODUCTION_ID                                                                 
) REFERENCES M_PRODUCTION (                                                     
M_PRODUCTION_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCTOPERATION ADD                                              
CONSTRAINT MPRODUCT_MPRODUCTOPERATION                                           
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCTPRICE ADD                                                  
CONSTRAINT MPRODUCT_MPRODUCTPRICE                                               
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCTPRICE ADD                                                  
CONSTRAINT MPRICELISTVER_MPRODUCTPRICE                                          
FOREIGN KEY (                                                                   
M_PRICELIST_VERSION_ID                                                          
) REFERENCES M_PRICELIST_VERSION (                                              
M_PRICELIST_VERSION_ID                                                          
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT VC_PPURCHASEPV_MPRODUCT                                              
FOREIGN KEY (                                                                   
P_PURCHASEPRICEVARIANCE_ACCT                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT VC_PREVENUE_MPRODUCT                                                 
FOREIGN KEY (                                                                   
P_REVENUE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT VC_PEXPENSE_MPRODUCT                                                 
FOREIGN KEY (                                                                   
P_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT VC_PINVOICEPV_MPRODUCT                                               
FOREIGN KEY (                                                                   
P_INVOICEPRICEVARIANCE_ACCT                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT VC_PTDISCOUNTGRANT_MPRODUCT                                          
FOREIGN KEY (                                                                   
P_TRADEDISCOUNTGRANT_ACCT                                                       
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT CACCTSCHEMA_MPRODUCTACCT                                             
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT M_PRODUCT_M_PRODUCT_ACCT                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT VC_PTDISCOUNTREC_MPRODUCT                                            
FOREIGN KEY (                                                                   
P_TRADEDISCOUNTREC_ACCT                                                         
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT VC_PASSET_MPRODUCT                                                   
FOREIGN KEY (                                                                   
P_ASSET_ACCT                                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_ACCT ADD                                                  
CONSTRAINT VC_PCOGS_MPRODUCT                                                    
FOREIGN KEY (                                                                   
P_COGS_ACCT                                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_BOM ADD                                                   
CONSTRAINT MPRODUCT_MPRODUCTBOM                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_BOM ADD                                                   
CONSTRAINT MPRODUCT_BOMPRODUCT                                                  
FOREIGN KEY (                                                                   
M_PRODUCTBOM_ID                                                                 
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY ADD                                              
CONSTRAINT AASSETGROUP_MPRODUCTCATEGORY                                         
FOREIGN KEY (                                                                   
A_ASSET_GROUP_ID                                                                
) REFERENCES A_ASSET_GROUP (                                                    
A_ASSET_GROUP_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT VC_PTDISCOUNTREC_MPRODUCTCATEG                                       
FOREIGN KEY (                                                                   
P_TRADEDISCOUNTREC_ACCT                                                         
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT VC_PTDISCOUNTGRANT_MPRODUCTCAT                                       
FOREIGN KEY (                                                                   
P_TRADEDISCOUNTGRANT_ACCT                                                       
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT VC_PREVENUE_MPRODUCTCATEGORY                                         
FOREIGN KEY (                                                                   
P_REVENUE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT VC_PASSET_MPRODUCTCATEGORY                                           
FOREIGN KEY (                                                                   
P_ASSET_ACCT                                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT VC_PEXPENSE_MPRODUCTCATEGORY                                         
FOREIGN KEY (                                                                   
P_EXPENSE_ACCT                                                                  
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT VC_PPURCHASEPV_MPRODUCTCATEGOR                                       
FOREIGN KEY (                                                                   
P_PURCHASEPRICEVARIANCE_ACCT                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT MPRODCAT_MPRODCATACCT                                                
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT CACCTSCHEMA_MPRODCATACCT                                             
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT VC_PINVOICEPV_MPRODUCTCATEGORY                                       
FOREIGN KEY (                                                                   
P_INVOICEPRICEVARIANCE_ACCT                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_CATEGORY_ACCT ADD                                         
CONSTRAINT VC_PCOGS_MPRODUCTCATEGORY                                            
FOREIGN KEY (                                                                   
P_COGS_ACCT                                                                     
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_COSTING ADD                                               
CONSTRAINT MPRODUCT_MPRODUCTCOSTING                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_COSTING ADD                                               
CONSTRAINT CACCTSCHEMA_MPRODUCTCOSTING                                          
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_PO ADD                                                    
CONSTRAINT C_BUSPARTNER_M_PRODUCT_PO                                            
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_PO ADD                                                    
CONSTRAINT M_PRODUCTPO_CLIENT                                                   
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_PO ADD                                                    
CONSTRAINT CCURRENCY_MPRODUCTPO                                                 
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_PO ADD                                                    
CONSTRAINT C_UOM_M_PRODUCT_PO                                                   
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_PO ADD                                                    
CONSTRAINT M_PRODUCTPO_ORG                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_PRODUCT_PO ADD                                                    
CONSTRAINT M_PRODUCT_PRODUCTPO                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_TRL ADD                                                   
CONSTRAINT MPRODUCT_MPRODUCTTRL                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_PRODUCT_TRL ADD                                                   
CONSTRAINT ADLANGUAGE_MPRODUCTTRL                                               
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
;                                                                               
ALTER TABLE M_RELATEDPRODUCT ADD                                                
CONSTRAINT MPRODUCT_MRELATED_PRODUCT                                            
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_RELATEDPRODUCT ADD                                                
CONSTRAINT MPRODUCT_MRELATEDPRODUCT                                             
FOREIGN KEY (                                                                   
RELATEDPRODUCT_ID                                                               
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_REPLENISH ADD                                                     
CONSTRAINT M_WAREHOUSE_REPLENISH                                                
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_REPLENISH ADD                                                     
CONSTRAINT M_PRODUCT_REPLENISH                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_REQUISITION ADD                                                   
CONSTRAINT MWAREHOUSE_MREQUISITION                                              
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_REQUISITION ADD                                                   
CONSTRAINT ADUSER_MREQUISITION                                                  
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE M_REQUISITION ADD                                                   
CONSTRAINT MPROCELIST_MREQUISITION                                              
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_REQUISITIONLINE ADD                                               
CONSTRAINT MPRODUCT_MREQUISITIONLINE                                            
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_REQUISITIONLINE ADD                                               
CONSTRAINT MREQUISITION_MREQUISITIONLINE                                        
FOREIGN KEY (                                                                   
M_REQUISITION_ID                                                                
) REFERENCES M_REQUISITION (                                                    
M_REQUISITION_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_RMA ADD                                                           
CONSTRAINT MINOUT_MRMA                                                          
FOREIGN KEY (                                                                   
M_INOUT_ID                                                                      
) REFERENCES M_INOUT (                                                          
M_INOUT_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE M_RMALINE ADD                                                       
CONSTRAINT MRMA_MRMALINE                                                        
FOREIGN KEY (                                                                   
M_RMA_ID                                                                        
) REFERENCES M_RMA (                                                            
M_RMA_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE M_RMALINE ADD                                                       
CONSTRAINT MINOUTLINE_MRMALINE                                                  
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_SHIPPER ADD                                                       
CONSTRAINT CBPARTNER_MSHIPPER                                                   
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_STORAGE ADD                                                       
CONSTRAINT M_LOCATOR_STORAGE                                                    
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_STORAGE ADD                                                       
CONSTRAINT M_ITEM_STORAGE_ORG                                                   
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_STORAGE ADD                                                       
CONSTRAINT M_ITEM_STORAGE_CLIENT                                                
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_STORAGE ADD                                                       
CONSTRAINT MATTRSETINST_MSTORAGE                                                
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_STORAGE ADD                                                       
CONSTRAINT MPRODUCT_STORAGE                                                     
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_SUBSTITUTE ADD                                                    
CONSTRAINT M_SUBSTITUTE_ORG                                                     
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_SUBSTITUTE ADD                                                    
CONSTRAINT MPRODUCT_SUBSTITUTESUB                                               
FOREIGN KEY (                                                                   
SUBSTITUTE_ID                                                                   
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_SUBSTITUTE ADD                                                    
CONSTRAINT MPRODUCT_SUBSTITUTE                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_SUBSTITUTE ADD                                                    
CONSTRAINT M_SUBSTITUTE_CLIENT                                                  
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT MLOCATOR_MINVENTORYCOUNT                                             
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT MATTRSETINST_MTRANSACTION                                            
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT CPROJECTISSUE_MTRANSACTION                                           
FOREIGN KEY (                                                                   
C_PROJECTISSUE_ID                                                               
) REFERENCES C_PROJECTISSUE (                                                   
C_PROJECTISSUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT MPRODUCT_MINVENTORYCOUNT                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT MMOVEMENTLINE_MTRANSACTION                                           
FOREIGN KEY (                                                                   
M_MOVEMENTLINE_ID                                                               
) REFERENCES M_MOVEMENTLINE (                                                   
M_MOVEMENTLINE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT MINOUTLINE_MTRANSACTION                                              
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT MINVENTORYLINE_MTRANSACTION                                          
FOREIGN KEY (                                                                   
M_INVENTORYLINE_ID                                                              
) REFERENCES M_INVENTORYLINE (                                                  
M_INVENTORYLINE_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTION ADD                                                   
CONSTRAINT MPRODUCTIONLINE_MTRANSACTION                                         
FOREIGN KEY (                                                                   
M_PRODUCTIONLINE_ID                                                             
) REFERENCES M_PRODUCTIONLINE (                                                 
M_PRODUCTIONLINE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MINOUTLINE_MTRXALLOC                                                 
FOREIGN KEY (                                                                   
M_INOUTLINE_ID                                                                  
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MATTRIBUTESETINST_MTRXALLOC                                          
FOREIGN KEY (                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
) REFERENCES M_ATTRIBUTESETINSTANCE (                                           
M_ATTRIBUTESETINSTANCE_ID                                                       
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MTTRANSACTION_MTRXALLOC                                              
FOREIGN KEY (                                                                   
M_TRANSACTION_ID                                                                
) REFERENCES M_TRANSACTION (                                                    
M_TRANSACTION_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MTRANSACTIONOUT_MTRXALLOC                                            
FOREIGN KEY (                                                                   
OUT_M_TRANSACTION_ID                                                            
) REFERENCES M_TRANSACTION (                                                    
M_TRANSACTION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MPRODUCTIONLINE_MTRXALLOC                                            
FOREIGN KEY (                                                                   
M_PRODUCTIONLINE_ID                                                             
) REFERENCES M_PRODUCTIONLINE (                                                 
M_PRODUCTIONLINE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MINOUTLINEOUT_MTRXALLOC                                              
FOREIGN KEY (                                                                   
OUT_M_INOUTLINE_ID                                                              
) REFERENCES M_INOUTLINE (                                                      
M_INOUTLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MINVENTORYLINEOUT_MTRXALLOC                                          
FOREIGN KEY (                                                                   
OUT_M_INVENTORYLINE_ID                                                          
) REFERENCES M_INVENTORYLINE (                                                  
M_INVENTORYLINE_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MINVENTORYLINE_MTRXALLOC                                             
FOREIGN KEY (                                                                   
M_INVENTORYLINE_ID                                                              
) REFERENCES M_INVENTORYLINE (                                                  
M_INVENTORYLINE_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MPRODUCTIONLINEOUT_MTRXALLOC                                         
FOREIGN KEY (                                                                   
OUT_M_PRODUCTIONLINE_ID                                                         
) REFERENCES M_PRODUCTIONLINE (                                                 
M_PRODUCTIONLINE_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE M_TRANSACTIONALLOCATION ADD                                         
CONSTRAINT MPRODUCT_MTRXALLOC                                                   
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_WAREHOUSE ADD                                                     
CONSTRAINT M_WAREHOUSE_CLIENT                                                   
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE M_WAREHOUSE ADD                                                     
CONSTRAINT C_LOCATION_WAREHOUSE                                                 
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE M_WAREHOUSE ADD                                                     
CONSTRAINT M_WAREHOUSE_ORG                                                      
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE M_WAREHOUSE_ACCT ADD                                                
CONSTRAINT VC_WREVALUATION_MWAREHOUSE                                           
FOREIGN KEY (                                                                   
W_REVALUATION_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_WAREHOUSE_ACCT ADD                                                
CONSTRAINT VC_WINVENTORY_MWAREHOUSE                                             
FOREIGN KEY (                                                                   
W_INVENTORY_ACCT                                                                
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_WAREHOUSE_ACCT ADD                                                
CONSTRAINT VC_WDIFFERENCES_MWAREHOUSE                                           
FOREIGN KEY (                                                                   
W_DIFFERENCES_ACCT                                                              
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE M_WAREHOUSE_ACCT ADD                                                
CONSTRAINT CACCTSCHEMA_MWAREHOUSEACCT                                           
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_WAREHOUSE_ACCT ADD                                                
CONSTRAINT M_WAREHOUSE_WAREHOUSE_ACCT                                           
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE M_WAREHOUSE_ACCT ADD                                                
CONSTRAINT VC_WINVACTUALADJUST_MWAREHOUSE                                       
FOREIGN KEY (                                                                   
W_INVACTUALADJUST_ACCT                                                          
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE PA_ACHIEVEMENT ADD                                                  
CONSTRAINT PA_ACHIEVEMENT_PARENT                                                
FOREIGN KEY (                                                                   
PARENT_ID                                                                       
) REFERENCES PA_ACHIEVEMENT (                                                   
PA_ACHIEVEMENT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE PA_GOAL ADD                                                         
CONSTRAINT PA_GOAL_PARENT                                                       
FOREIGN KEY (                                                                   
PARENT_ID                                                                       
) REFERENCES PA_GOAL (                                                          
PA_GOAL_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE PA_GOAL ADD                                                         
CONSTRAINT PAMEASURE_PAGOAL                                                     
FOREIGN KEY (                                                                   
PA_MEASURE_ID                                                                   
) REFERENCES PA_MEASURE (                                                       
PA_MEASURE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_MEASURE ADD                                                      
CONSTRAINT MPRODUCT_PAMEASURE                                                   
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE PA_MEASURE ADD                                                      
CONSTRAINT CBPGROUP_PAMEASURE                                                   
FOREIGN KEY (                                                                   
C_BP_GROUP_ID                                                                   
) REFERENCES C_BP_GROUP (                                                       
C_BP_GROUP_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_MEASURE ADD                                                      
CONSTRAINT ADORG_PAMEASURE                                                      
FOREIGN KEY (                                                                   
ORG_ID                                                                          
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE PA_MEASURE ADD                                                      
CONSTRAINT PAACHIEVEMENT_PAMEASURE                                              
FOREIGN KEY (                                                                   
PA_ACHIEVEMENT_ID                                                               
) REFERENCES PA_ACHIEVEMENT (                                                   
PA_ACHIEVEMENT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE PA_MEASURE ADD                                                      
CONSTRAINT MPRODUCTCATEGORY_PAMEASURE                                           
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE PA_MEASURE ADD                                                      
CONSTRAINT CBPARTNER_PAMEASURE                                                  
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_MEASURE ADD                                                      
CONSTRAINT PAMEASURECALC_PAMEASURE                                              
FOREIGN KEY (                                                                   
PA_MEASURECALC_ID                                                               
) REFERENCES PA_MEASURECALC (                                                   
PA_MEASURECALC_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE PA_REPORT ADD                                                       
CONSTRAINT CACCTSCHEMA_PAREPORT                                                 
FOREIGN KEY (                                                                   
C_ACCTSCHEMA_ID                                                                 
) REFERENCES C_ACCTSCHEMA (                                                     
C_ACCTSCHEMA_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE PA_REPORT ADD                                                       
CONSTRAINT ADORG_PAREPORT                                                       
FOREIGN KEY (                                                                   
AD_ORG_ID                                                                       
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE PA_REPORT ADD                                                       
CONSTRAINT ADPRINTFORMAT_PAREPORT                                               
FOREIGN KEY (                                                                   
AD_PRINTFORMAT_ID                                                               
) REFERENCES AD_PRINTFORMAT (                                                   
AD_PRINTFORMAT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE PA_REPORT ADD                                                       
CONSTRAINT PAREPORT_LINESET                                                     
FOREIGN KEY (                                                                   
PA_REPORTLINESET_ID                                                             
) REFERENCES PA_REPORTLINESET (                                                 
PA_REPORTLINESET_ID                                                             
)                                                                               
;                                                                               
ALTER TABLE PA_REPORT ADD                                                       
CONSTRAINT PAREPORT_COLUMNSET                                                   
FOREIGN KEY (                                                                   
PA_REPORTCOLUMNSET_ID                                                           
) REFERENCES PA_REPORTCOLUMNSET (                                               
PA_REPORTCOLUMNSET_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE PA_REPORT ADD                                                       
CONSTRAINT CCALENDAR_PAREPORT                                                   
FOREIGN KEY (                                                                   
C_CALENDAR_ID                                                                   
) REFERENCES C_CALENDAR (                                                       
C_CALENDAR_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT CSALESREGION_PAREPORTCOLUMN                                          
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT CLOCATION_PAREPORTCOLUMN                                             
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT PAREPORTCOLUMN_OPER1                                                 
FOREIGN KEY (                                                                   
OPER_1_ID                                                                       
) REFERENCES PA_REPORTCOLUMN (                                                  
PA_REPORTCOLUMN_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT MPRODUCT_PAREPORTCOLUMN                                              
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT CPROJECT_PAREPORTCOLUMN                                              
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT ADORG_PAREPORTCOLUMN                                                 
FOREIGN KEY (                                                                   
ORG_ID                                                                          
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT CACTIVITY_PAREPORTCOLUMN                                             
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT CBPARTNER_PAREPORTCOLUMN                                             
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT PAREPORTCOLUMNSET_COLUMN                                             
FOREIGN KEY (                                                                   
PA_REPORTCOLUMNSET_ID                                                           
) REFERENCES PA_REPORTCOLUMNSET (                                               
PA_REPORTCOLUMNSET_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT CCAMPAIGN_PAREPORTCOLUMN                                             
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT CCURRENCY_PAREPORTCOLUMN                                             
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT CELEMENTVALUE_PAREPORTCOLUMN                                         
FOREIGN KEY (                                                                   
C_ELEMENTVALUE_ID                                                               
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT GLBUDGET_PAREPORTCOLUMN                                              
FOREIGN KEY (                                                                   
GL_BUDGET_ID                                                                    
) REFERENCES GL_BUDGET (                                                        
GL_BUDGET_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTCOLUMN ADD                                                 
CONSTRAINT PAREPORTCOLUMN_OPER2                                                 
FOREIGN KEY (                                                                   
OPER_2_ID                                                                       
) REFERENCES PA_REPORTCOLUMN (                                                  
PA_REPORTCOLUMN_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTLINE ADD                                                   
CONSTRAINT PAREPORTLINESET_LINE                                                 
FOREIGN KEY (                                                                   
PA_REPORTLINESET_ID                                                             
) REFERENCES PA_REPORTLINESET (                                                 
PA_REPORTLINESET_ID                                                             
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE PA_REPORTLINE ADD                                                   
CONSTRAINT PAREPORTLINE_OPER1                                                   
FOREIGN KEY (                                                                   
OPER_1_ID                                                                       
) REFERENCES PA_REPORTLINE (                                                    
PA_REPORTLINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTLINE ADD                                                   
CONSTRAINT PAREPORTLINE_PARENT                                                  
FOREIGN KEY (                                                                   
PARENT_ID                                                                       
) REFERENCES PA_REPORTLINE (                                                    
PA_REPORTLINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTLINE ADD                                                   
CONSTRAINT GLBUDGET_PAREPORTLINE                                                
FOREIGN KEY (                                                                   
GL_BUDGET_ID                                                                    
) REFERENCES GL_BUDGET (                                                        
GL_BUDGET_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTLINE ADD                                                   
CONSTRAINT PAREPORTLINE_OPER2                                                   
FOREIGN KEY (                                                                   
OPER_2_ID                                                                       
) REFERENCES PA_REPORTLINE (                                                    
PA_REPORTLINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT CACTIVITY_PAREPORTSOURCE                                             
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT CPROJECT_PAREPORTSOURCE                                              
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT CCAMPAIGN_PAREPORTSOURCE                                             
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT ADORG_PAREPORTSOURCE                                                 
FOREIGN KEY (                                                                   
ORG_ID                                                                          
) REFERENCES AD_ORG (                                                           
AD_ORG_ID                                                                       
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT CSALESREGION_PAREPORTSOURCE                                          
FOREIGN KEY (                                                                   
C_SALESREGION_ID                                                                
) REFERENCES C_SALESREGION (                                                    
C_SALESREGION_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT PAREPORTLINE_PAREPORTSOURCE                                          
FOREIGN KEY (                                                                   
PA_REPORTLINE_ID                                                                
) REFERENCES PA_REPORTLINE (                                                    
PA_REPORTLINE_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT CELEMENTVALUE_PAREPORTSOURCE                                         
FOREIGN KEY (                                                                   
C_ELEMENTVALUE_ID                                                               
) REFERENCES C_ELEMENTVALUE (                                                   
C_ELEMENTVALUE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT CLOCATION_PAREPORTSOURCE                                             
FOREIGN KEY (                                                                   
C_LOCATION_ID                                                                   
) REFERENCES C_LOCATION (                                                       
C_LOCATION_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT CBPARTNER_PAREPORTSOURCE                                             
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_REPORTSOURCE ADD                                                 
CONSTRAINT MPRODUCT_PAREPORTSOURCE                                              
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE PA_SLA_GOAL ADD                                                     
CONSTRAINT CBPARTNER_PASLAGOAL                                                  
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE PA_SLA_GOAL ADD                                                     
CONSTRAINT PASLACRITERIA_PASLAGOAL                                              
FOREIGN KEY (                                                                   
PA_SLA_CRITERIA_ID                                                              
) REFERENCES PA_SLA_CRITERIA (                                                  
PA_SLA_CRITERIA_ID                                                              
)                                                                               
;                                                                               
ALTER TABLE PA_SLA_MEASURE ADD                                                  
CONSTRAINT PASLAGOAL_PASLAMEASURE                                               
FOREIGN KEY (                                                                   
PA_SLA_GOAL_ID                                                                  
) REFERENCES PA_SLA_GOAL (                                                      
PA_SLA_GOAL_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE PA_SLA_MEASURE ADD                                                  
CONSTRAINT ADTABLE_PASLAMEASURE                                                 
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE R_CATEGORYUPDATES ADD                                               
CONSTRAINT ADUSER_RCATEGORYUPDATES                                              
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_CATEGORYUPDATES ADD                                               
CONSTRAINT RCATEGORY_RCATEGORYUPDATES                                           
FOREIGN KEY (                                                                   
R_CATEGORY_ID                                                                   
) REFERENCES R_CATEGORY (                                                       
R_CATEGORY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_CONTACTINTEREST ADD                                               
CONSTRAINT RINTERESTAREA_RCONTACTINTEREST                                       
FOREIGN KEY (                                                                   
R_INTERESTAREA_ID                                                               
) REFERENCES R_INTERESTAREA (                                                   
R_INTERESTAREA_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE R_CONTACTINTEREST ADD                                               
CONSTRAINT ADUSER_RCONTACTINTEREST                                              
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_GROUPUPDATES ADD                                                  
CONSTRAINT ADUSER_RUSERUPDATES                                                  
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_GROUPUPDATES ADD                                                  
CONSTRAINT RGROUP_RGROUPUPDATES                                                 
FOREIGN KEY (                                                                   
R_GROUP_ID                                                                      
) REFERENCES R_GROUP (                                                          
R_GROUP_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT CCAMPAIGN_RREQUEST                                                   
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RGROUP_RREQUEST                                                      
FOREIGN KEY (                                                                   
R_GROUP_ID                                                                      
) REFERENCES R_GROUP (                                                          
R_GROUP_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT CORDER_RREQUEST                                                      
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RREQUESTTYPE_RREQUEST                                                
FOREIGN KEY (                                                                   
R_REQUESTTYPE_ID                                                                
) REFERENCES R_REQUESTTYPE (                                                    
R_REQUESTTYPE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT MPRODUCT_RREQUEST                                                    
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RREQUEST_RELATED                                                     
FOREIGN KEY (                                                                   
R_REQUESTRELATED_ID                                                             
) REFERENCES R_REQUEST (                                                        
R_REQUEST_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RCATEGORY_RREQUEST                                                   
FOREIGN KEY (                                                                   
R_CATEGORY_ID                                                                   
) REFERENCES R_CATEGORY (                                                       
R_CATEGORY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT MRMA_RREQUEST                                                        
FOREIGN KEY (                                                                   
M_RMA_ID                                                                        
) REFERENCES M_RMA (                                                            
M_RMA_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT MPRODUCTSPENT_RREQUEST                                               
FOREIGN KEY (                                                                   
M_PRODUCTSPENT_ID                                                               
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT MINOUT_RREQUEST                                                      
FOREIGN KEY (                                                                   
M_INOUT_ID                                                                      
) REFERENCES M_INOUT (                                                          
M_INOUT_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT CINVOICEREQUEST_RREQUEST                                             
FOREIGN KEY (                                                                   
C_INVOICEREQUEST_ID                                                             
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT ADTABLE_RREQUEST                                                     
FOREIGN KEY (                                                                   
AD_TABLE_ID                                                                     
) REFERENCES AD_TABLE (                                                         
AD_TABLE_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT ADROLE_RREQUEST                                                      
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RSTATUS_RREQUEST                                                     
FOREIGN KEY (                                                                   
R_STATUS_ID                                                                     
) REFERENCES R_STATUS (                                                         
R_STATUS_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RSTANDARDRESPONSE_RREQUEST                                           
FOREIGN KEY (                                                                   
R_STANDARDRESPONSE_ID                                                           
) REFERENCES R_STANDARDRESPONSE (                                               
R_STANDARDRESPONSE_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RRESOLUTION_RREQUEST                                                 
FOREIGN KEY (                                                                   
R_RESOLUTION_ID                                                                 
) REFERENCES R_RESOLUTION (                                                     
R_RESOLUTION_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT ADUSERSR_RREQUEST                                                    
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT CACTIVITY_RREQUEST                                                   
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT ADUSER_RREQUEST                                                      
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT CPAYMENT_RREQUEST                                                    
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT CPROJECT_RREQUEST                                                    
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT C_BPARTNER_RREQUEST                                                  
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RINVOICE_RREQUEST                                                    
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT AASSET_RREQUEST                                                      
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUEST ADD                                                       
CONSTRAINT RMAILTEXT_RREQUEST                                                   
FOREIGN KEY (                                                                   
R_MAILTEXT_ID                                                                   
) REFERENCES R_MAILTEXT (                                                       
R_MAILTEXT_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT RGROUP_RREQUESTACTION                                                
FOREIGN KEY (                                                                   
R_GROUP_ID                                                                      
) REFERENCES R_GROUP (                                                          
R_GROUP_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT ADROLE_RREQUESTACTION                                                
FOREIGN KEY (                                                                   
AD_ROLE_ID                                                                      
) REFERENCES AD_ROLE (                                                          
AD_ROLE_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT RSTATUS_RREQUESTACTION                                               
FOREIGN KEY (                                                                   
R_STATUS_ID                                                                     
) REFERENCES R_STATUS (                                                         
R_STATUS_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT RRESOLUTION_RREQUESTACTION                                           
FOREIGN KEY (                                                                   
R_RESOLUTION_ID                                                                 
) REFERENCES R_RESOLUTION (                                                     
R_RESOLUTION_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT MPRODUCT_RREQUESTACTION                                              
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT RCATEGORY_RREQUESTACTION                                             
FOREIGN KEY (                                                                   
R_CATEGORY_ID                                                                   
) REFERENCES R_CATEGORY (                                                       
R_CATEGORY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT MRMA_RREQUESTACTION                                                  
FOREIGN KEY (                                                                   
M_RMA_ID                                                                        
) REFERENCES M_RMA (                                                            
M_RMA_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT MINOUT_MREQUESTACTION                                                
FOREIGN KEY (                                                                   
M_INOUT_ID                                                                      
) REFERENCES M_INOUT (                                                          
M_INOUT_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT AASSET_RREQUESTACTION                                                
FOREIGN KEY (                                                                   
A_ASSET_ID                                                                      
) REFERENCES A_ASSET (                                                          
A_ASSET_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT ADUSER_RREQUESTACTION                                                
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT CBPARTNER_RREQUESTACTION                                             
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT CINVOICE_RREQUESTACTION                                              
FOREIGN KEY (                                                                   
C_INVOICE_ID                                                                    
) REFERENCES C_INVOICE (                                                        
C_INVOICE_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT CORDER_RREQUESTACTION                                                
FOREIGN KEY (                                                                   
C_ORDER_ID                                                                      
) REFERENCES C_ORDER (                                                          
C_ORDER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT CPROJECT_RREQUESTACTION                                              
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT RREQUEST_RREQUESTACTION                                              
FOREIGN KEY (                                                                   
R_REQUEST_ID                                                                    
) REFERENCES R_REQUEST (                                                        
R_REQUEST_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT ADUSERSR_RREQUESTACTION                                              
FOREIGN KEY (                                                                   
SALESREP_ID                                                                     
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT CACTIVITY_RREQUESTACTION                                             
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT CPAYMENT_RREQUESTACTION                                              
FOREIGN KEY (                                                                   
C_PAYMENT_ID                                                                    
) REFERENCES C_PAYMENT (                                                        
C_PAYMENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTACTION ADD                                                 
CONSTRAINT RREQUESTTYPE_RREQUESTACTION                                          
FOREIGN KEY (                                                                   
R_REQUESTTYPE_ID                                                                
) REFERENCES R_REQUESTTYPE (                                                    
R_REQUESTTYPE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTPROCESSOR ADD                                              
CONSTRAINT ADUSER_RREQUESTPROCESSOR                                             
FOREIGN KEY (                                                                   
SUPERVISOR_ID                                                                   
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTPROCESSORLOG ADD                                           
CONSTRAINT RREQUESTPROCESSOR_LOG                                                
FOREIGN KEY (                                                                   
R_REQUESTPROCESSOR_ID                                                           
) REFERENCES R_REQUESTPROCESSOR (                                               
R_REQUESTPROCESSOR_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE R_REQUESTPROCESSOR_ROUTE ADD                                        
CONSTRAINT RREQUESTTYPE_RPROCESSORRULE                                          
FOREIGN KEY (                                                                   
R_REQUESTTYPE_ID                                                                
) REFERENCES R_REQUESTTYPE (                                                    
R_REQUESTTYPE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTPROCESSOR_ROUTE ADD                                        
CONSTRAINT ADUSER_RREQUESTPROCESSORROUTE                                        
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTPROCESSOR_ROUTE ADD                                        
CONSTRAINT RREQUESTPROCESSOR_ROUTE                                              
FOREIGN KEY (                                                                   
R_REQUESTPROCESSOR_ID                                                           
) REFERENCES R_REQUESTPROCESSOR (                                               
R_REQUESTPROCESSOR_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTTYPEUPDATES ADD                                            
CONSTRAINT ADUSER_RREQUESTTYPEUPDATES                                           
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTTYPEUPDATES ADD                                            
CONSTRAINT RREQUESTTYPE_RRTUPDATES                                              
FOREIGN KEY (                                                                   
R_REQUESTTYPE_ID                                                                
) REFERENCES R_REQUESTTYPE (                                                    
R_REQUESTTYPE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTUPDATE ADD                                                 
CONSTRAINT RREQUEST_RREQUESTUPDATE                                              
FOREIGN KEY (                                                                   
R_REQUEST_ID                                                                    
) REFERENCES R_REQUEST (                                                        
R_REQUEST_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTUPDATES ADD                                                
CONSTRAINT ADUSER_RREQUESTUPDATES                                               
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE R_REQUESTUPDATES ADD                                                
CONSTRAINT RREQUEST_RRUPDATES                                                   
FOREIGN KEY (                                                                   
R_REQUEST_ID                                                                    
) REFERENCES R_REQUEST (                                                        
R_REQUEST_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE S_EXPENSETYPE ADD                                                   
CONSTRAINT MPRODUCTCATEGORY_SEXPENSETYPE                                        
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE S_EXPENSETYPE ADD                                                   
CONSTRAINT CUOM_SEXPENSETYPE                                                    
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE S_EXPENSETYPE ADD                                                   
CONSTRAINT CTAXCATEGORY_SEXPENSETYPE                                            
FOREIGN KEY (                                                                   
C_TAXCATEGORY_ID                                                                
) REFERENCES C_TAXCATEGORY (                                                    
C_TAXCATEGORY_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE S_RESOURCE ADD                                                      
CONSTRAINT SRESOURCETYPE_SRESOURCE                                              
FOREIGN KEY (                                                                   
S_RESOURCETYPE_ID                                                               
) REFERENCES S_RESOURCETYPE (                                                   
S_RESOURCETYPE_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE S_RESOURCE ADD                                                      
CONSTRAINT ADUSER_SRESOURCE                                                     
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE S_RESOURCE ADD                                                      
CONSTRAINT MWAREHOUSE_SRESOURCE                                                 
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE S_RESOURCEASSIGNMENT ADD                                            
CONSTRAINT SRESOURCE_SRESOURCEASSIGNMENT                                        
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE S_RESOURCETYPE ADD                                                  
CONSTRAINT CTAXCATEGORY_SRESOURCETYPE                                           
FOREIGN KEY (                                                                   
C_TAXCATEGORY_ID                                                                
) REFERENCES C_TAXCATEGORY (                                                    
C_TAXCATEGORY_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE S_RESOURCETYPE ADD                                                  
CONSTRAINT MPRODCATEGORY_SRESOURCETYPE                                          
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE S_RESOURCETYPE ADD                                                  
CONSTRAINT CUOM_SRESOURCETYPE                                                   
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE S_RESOURCEUNAVAILABLE ADD                                           
CONSTRAINT SRESOURCE_SRESUNAVAILABLE                                            
FOREIGN KEY (                                                                   
S_RESOURCE_ID                                                                   
) REFERENCES S_RESOURCE (                                                       
S_RESOURCE_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE S_TIMEEXPENSE ADD                                                   
CONSTRAINT MWAREHOUSE_STIMEEXPENSE                                              
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSE ADD                                                   
CONSTRAINT MPRICELIST_STIMEEXPENSE                                              
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSE ADD                                                   
CONSTRAINT CBPARTNER_STIMEEXPENSE                                               
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT MPRODUCT_STIMEEXPENSELINE                                            
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CCURRENCY_STIMEEXPENSELINE                                           
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CINVOICELINE_STIMEEXPENSELINE                                        
FOREIGN KEY (                                                                   
C_INVOICELINE_ID                                                                
) REFERENCES C_INVOICELINE (                                                    
C_INVOICELINE_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CORDERLINE_STIMEEXPENSELINE                                          
FOREIGN KEY (                                                                   
C_ORDERLINE_ID                                                                  
) REFERENCES C_ORDERLINE (                                                      
C_ORDERLINE_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CCAMPAIGN_STIMEEXPENSELINE                                           
FOREIGN KEY (                                                                   
C_CAMPAIGN_ID                                                                   
) REFERENCES C_CAMPAIGN (                                                       
C_CAMPAIGN_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CACTIVITY_STIMEEXPENSELINE                                           
FOREIGN KEY (                                                                   
C_ACTIVITY_ID                                                                   
) REFERENCES C_ACTIVITY (                                                       
C_ACTIVITY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CPROJECTPHASE_STIMEEXPENSELINE                                       
FOREIGN KEY (                                                                   
C_PROJECTPHASE_ID                                                               
) REFERENCES C_PROJECTPHASE (                                                   
C_PROJECTPHASE_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CPROJECT_STIMEEXPENSELINE                                            
FOREIGN KEY (                                                                   
C_PROJECT_ID                                                                    
) REFERENCES C_PROJECT (                                                        
C_PROJECT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CUOM_STIMEEXPENSELINE                                                
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CPROJECTTASK_STIMEEXPENSELINE                                        
FOREIGN KEY (                                                                   
C_PROJECTTASK_ID                                                                
) REFERENCES C_PROJECTTASK (                                                    
C_PROJECTTASK_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT SRESOURCEASSIGN_STELINE                                              
FOREIGN KEY (                                                                   
S_RESOURCEASSIGNMENT_ID                                                         
) REFERENCES S_RESOURCEASSIGNMENT (                                             
S_RESOURCEASSIGNMENT_ID                                                         
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT STIMEEXPENSE_LINE                                                    
FOREIGN KEY (                                                                   
S_TIMEEXPENSE_ID                                                                
) REFERENCES S_TIMEEXPENSE (                                                    
S_TIMEEXPENSE_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT STIMETYPE_STIMEEXPENSELINE                                           
FOREIGN KEY (                                                                   
S_TIMETYPE_ID                                                                   
) REFERENCES S_TIMETYPE (                                                       
S_TIMETYPE_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE S_TIMEEXPENSELINE ADD                                               
CONSTRAINT CBPARTNER_STIMEEXPENSELINE                                           
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE S_TRAINING ADD                                                      
CONSTRAINT CTAXCATEGORY_STRAINING                                               
FOREIGN KEY (                                                                   
C_TAXCATEGORY_ID                                                                
) REFERENCES C_TAXCATEGORY (                                                    
C_TAXCATEGORY_ID                                                                
)                                                                               
;                                                                               
ALTER TABLE S_TRAINING ADD                                                      
CONSTRAINT CUOM_STRAINING                                                       
FOREIGN KEY (                                                                   
C_UOM_ID                                                                        
) REFERENCES C_UOM (                                                            
C_UOM_ID                                                                        
)                                                                               
;                                                                               
ALTER TABLE S_TRAINING ADD                                                      
CONSTRAINT MPRODUCTCATEGORY_STRAINING                                           
FOREIGN KEY (                                                                   
M_PRODUCT_CATEGORY_ID                                                           
) REFERENCES M_PRODUCT_CATEGORY (                                               
M_PRODUCT_CATEGORY_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE S_TRAINING_CLASS ADD                                                
CONSTRAINT STRAINING_STRAININGCLASS                                             
FOREIGN KEY (                                                                   
S_TRAINING_ID                                                                   
) REFERENCES S_TRAINING (                                                       
S_TRAINING_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE S_TRAINING_CLASS ADD                                                
CONSTRAINT MPRODUCT_STRAININGCLASS                                              
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE TEST ADD                                                            
CONSTRAINT VC_ACCOUNT_TEST                                                      
FOREIGN KEY (                                                                   
ACCOUNT_ACCT                                                                    
) REFERENCES C_VALIDCOMBINATION (                                               
C_VALIDCOMBINATION_ID                                                           
)                                                                               
;                                                                               
ALTER TABLE TIRE_STORAGE ADD                                                    
CONSTRAINT MLOCATOR_TIRESTORAGE                                                 
FOREIGN KEY (                                                                   
M_LOCATOR_ID                                                                    
) REFERENCES M_LOCATOR (                                                        
M_LOCATOR_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE TIRE_STORAGE ADD                                                    
CONSTRAINT ADUSER_TIRESTORAGE                                                   
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE TIRE_STORAGE ADD                                                    
CONSTRAINT CBPARTNER_TIRESTORAGE                                                
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE T_AGING ADD                                                         
CONSTRAINT CCURRENCY_TAGING                                                     
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE T_AGING ADD                                                         
CONSTRAINT CBPGROUP_TAGING                                                      
FOREIGN KEY (                                                                   
C_BP_GROUP_ID                                                                   
) REFERENCES C_BP_GROUP (                                                       
C_BP_GROUP_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE T_AGING ADD                                                         
CONSTRAINT CBPARTNER_TAGING                                                     
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_AGING ADD                                                         
CONSTRAINT ADPINSTANCE_TAGING                                                   
FOREIGN KEY (                                                                   
AD_PINSTANCE_ID                                                                 
) REFERENCES AD_PINSTANCE (                                                     
AD_PINSTANCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_DISTRIBUTIONRUNDETAIL ADD                                         
CONSTRAINT MDISTRIBUTIONRUN_TDRDETAIL                                           
FOREIGN KEY (                                                                   
M_DISTRIBUTIONRUN_ID                                                            
) REFERENCES M_DISTRIBUTIONRUN (                                                
M_DISTRIBUTIONRUN_ID                                                            
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_DISTRIBUTIONRUNDETAIL ADD                                         
CONSTRAINT MDISTRIBUTIONRLINE_TDRDETAIL                                         
FOREIGN KEY (                                                                   
M_DISTRIBUTIONRUNLINE_ID                                                        
) REFERENCES M_DISTRIBUTIONRUNLINE (                                            
M_DISTRIBUTIONRUNLINE_ID                                                        
)                                                                               
;                                                                               
ALTER TABLE T_DISTRIBUTIONRUNDETAIL ADD                                         
CONSTRAINT MDISTRIBUTIONLLINE_TDRDETAIL                                         
FOREIGN KEY (                                                                   
M_DISTRIBUTIONLISTLINE_ID                                                       
) REFERENCES M_DISTRIBUTIONLISTLINE (                                           
M_DISTRIBUTIONLISTLINE_ID                                                       
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_DISTRIBUTIONRUNDETAIL ADD                                         
CONSTRAINT MDISTRIBUTIONLIST_TDRDETAIL                                          
FOREIGN KEY (                                                                   
M_DISTRIBUTIONLIST_ID                                                           
) REFERENCES M_DISTRIBUTIONLIST (                                               
M_DISTRIBUTIONLIST_ID                                                           
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_DISTRIBUTIONRUNDETAIL ADD                                         
CONSTRAINT CBPARTNER_TDRDETAIL                                                  
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_DISTRIBUTIONRUNDETAIL ADD                                         
CONSTRAINT CBPARTNERLOCATION_TDRDETAIL                                          
FOREIGN KEY (                                                                   
C_BPARTNER_LOCATION_ID                                                          
) REFERENCES C_BPARTNER_LOCATION (                                              
C_BPARTNER_LOCATION_ID                                                          
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_DISTRIBUTIONRUNDETAIL ADD                                         
CONSTRAINT MPRODUCT_TDRDETAIL                                                   
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_INVENTORYVALUE ADD                                                
CONSTRAINT MWAREHOUSE_TINVENTORYVALUE                                           
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_INVENTORYVALUE ADD                                                
CONSTRAINT ADPINSTANCE_TINVENTORYVALUE                                          
FOREIGN KEY (                                                                   
AD_PINSTANCE_ID                                                                 
) REFERENCES AD_PINSTANCE (                                                     
AD_PINSTANCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_INVENTORYVALUE ADD                                                
CONSTRAINT CCURRENCY_TINVENTORYVALUE                                            
FOREIGN KEY (                                                                   
C_CURRENCY_ID                                                                   
) REFERENCES C_CURRENCY (                                                       
C_CURRENCY_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE T_INVENTORYVALUE ADD                                                
CONSTRAINT MPLVERSION_TINVENTORYVALUE                                           
FOREIGN KEY (                                                                   
M_PRICELIST_VERSION_ID                                                          
) REFERENCES M_PRICELIST_VERSION (                                              
M_PRICELIST_VERSION_ID                                                          
)                                                                               
;                                                                               
ALTER TABLE T_INVENTORYVALUE ADD                                                
CONSTRAINT MPRODUCT_TINVENTORYVALUE                                             
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_REPLENISH ADD                                                     
CONSTRAINT MWAREHOUSE_TREPLENISH                                                
FOREIGN KEY (                                                                   
M_WAREHOUSE_ID                                                                  
) REFERENCES M_WAREHOUSE (                                                      
M_WAREHOUSE_ID                                                                  
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_REPLENISH ADD                                                     
CONSTRAINT MPRODUCT_TREPLENISH                                                  
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_REPLENISH ADD                                                     
CONSTRAINT ADPINSTANCE_TREPLENISH                                               
FOREIGN KEY (                                                                   
AD_PINSTANCE_ID                                                                 
) REFERENCES AD_PINSTANCE (                                                     
AD_PINSTANCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_REPORT ADD                                                        
CONSTRAINT PAREPORTLINE_TREPORT                                                 
FOREIGN KEY (                                                                   
PA_REPORTLINE_ID                                                                
) REFERENCES PA_REPORTLINE (                                                    
PA_REPORTLINE_ID                                                                
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_REPORT ADD                                                        
CONSTRAINT ADPINSTANCE_TREPORT                                                  
FOREIGN KEY (                                                                   
AD_PINSTANCE_ID                                                                 
) REFERENCES AD_PINSTANCE (                                                     
AD_PINSTANCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE T_REPORTSTATEMENT ADD                                               
CONSTRAINT ADPINSTANCE_TREPORTSTATEMENT                                         
FOREIGN KEY (                                                                   
AD_PINSTANCE_ID                                                                 
) REFERENCES AD_PINSTANCE (                                                     
AD_PINSTANCE_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE T_SPOOL ADD                                                         
CONSTRAINT ADPINSTANCE_TSPOOL                                                   
FOREIGN KEY (                                                                   
AD_PINSTANCE_ID                                                                 
) REFERENCES AD_PINSTANCE (                                                     
AD_PINSTANCE_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE W_ADVERTISEMENT ADD                                                 
CONSTRAINT WCOUNTERCOUNT_WADVERTISEMENT                                         
FOREIGN KEY (                                                                   
W_COUNTERCOUNT_ID                                                               
) REFERENCES W_COUNTERCOUNT (                                                   
W_COUNTERCOUNT_ID                                                               
)                                                                               
;                                                                               
ALTER TABLE W_ADVERTISEMENT ADD                                                 
CONSTRAINT WCLICKCOUNT_WADVERTISEMENT                                           
FOREIGN KEY (                                                                   
W_CLICKCOUNT_ID                                                                 
) REFERENCES W_CLICKCOUNT (                                                     
W_CLICKCOUNT_ID                                                                 
)                                                                               
;                                                                               
ALTER TABLE W_ADVERTISEMENT ADD                                                 
CONSTRAINT CBPARTNER_WADVERTISEMENT                                             
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE W_ADVERTISEMENT ADD                                                 
CONSTRAINT ADUSER_WADVERTISEMENT                                                
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE W_BASKET ADD                                                        
CONSTRAINT MPRICELIST_WBASKET                                                   
FOREIGN KEY (                                                                   
M_PRICELIST_ID                                                                  
) REFERENCES M_PRICELIST (                                                      
M_PRICELIST_ID                                                                  
)                                                                               
;                                                                               
ALTER TABLE W_BASKET ADD                                                        
CONSTRAINT CBPARTNER_WBASKET                                                    
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE W_BASKET ADD                                                        
CONSTRAINT ADUSER_WBASKET                                                       
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE W_BASKETLINE ADD                                                    
CONSTRAINT WBASKET_WBASKETLINE                                                  
FOREIGN KEY (                                                                   
W_BASKET_ID                                                                     
) REFERENCES W_BASKET (                                                         
W_BASKET_ID                                                                     
)                                                                               
;                                                                               
ALTER TABLE W_BASKETLINE ADD                                                    
CONSTRAINT MPRODUCT_WBASKETLINE                                                 
FOREIGN KEY (                                                                   
M_PRODUCT_ID                                                                    
) REFERENCES M_PRODUCT (                                                        
M_PRODUCT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE W_CLICK ADD                                                         
CONSTRAINT WCLICKCOUNT_WCLICK                                                   
FOREIGN KEY (                                                                   
W_CLICKCOUNT_ID                                                                 
) REFERENCES W_CLICKCOUNT (                                                     
W_CLICKCOUNT_ID                                                                 
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE W_CLICK ADD                                                         
CONSTRAINT ADUSER_WCLICK                                                        
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE W_CLICKCOUNT ADD                                                    
CONSTRAINT CBPARTNER_WCLICKCOUNT                                                
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE W_COUNTER ADD                                                       
CONSTRAINT WCOUNTERCOUNT_WCOUNTER                                               
FOREIGN KEY (                                                                   
W_COUNTERCOUNT_ID                                                               
) REFERENCES W_COUNTERCOUNT (                                                   
W_COUNTERCOUNT_ID                                                               
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE W_COUNTER ADD                                                       
CONSTRAINT ADUSER_WCOUNTER                                                      
FOREIGN KEY (                                                                   
AD_USER_ID                                                                      
) REFERENCES AD_USER (                                                          
AD_USER_ID                                                                      
)                                                                               
;                                                                               
ALTER TABLE W_COUNTERCOUNT ADD                                                  
CONSTRAINT CBPARTNER_WCOUNTERCOUNT                                              
FOREIGN KEY (                                                                   
C_BPARTNER_ID                                                                   
) REFERENCES C_BPARTNER (                                                       
C_BPARTNER_ID                                                                   
)                                                                               
;                                                                               
ALTER TABLE W_MAILMSG ADD                                                       
CONSTRAINT WSTORE_WMAILMSG                                                      
FOREIGN KEY (                                                                   
W_STORE_ID                                                                      
) REFERENCES W_STORE (                                                          
W_STORE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE W_MAILMSG_TRL ADD                                                   
CONSTRAINT ADLANGUAGE_WMAILMSGTRL                                               
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE W_MAILMSG_TRL ADD                                                   
CONSTRAINT WMAILMSG_WMAILMSGTRL                                                 
FOREIGN KEY (                                                                   
W_MAILMSG_ID                                                                    
) REFERENCES W_MAILMSG (                                                        
W_MAILMSG_ID                                                                    
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE W_STORE ADD                                                         
CONSTRAINT ADCLIENT_WSTORE                                                      
FOREIGN KEY (                                                                   
AD_CLIENT_ID                                                                    
) REFERENCES AD_CLIENT (                                                        
AD_CLIENT_ID                                                                    
)                                                                               
;                                                                               
ALTER TABLE W_STORE_TRL ADD                                                     
CONSTRAINT WSTORETRL_ADLANGAUGE                                                 
FOREIGN KEY (                                                                   
AD_LANGUAGE                                                                     
) REFERENCES AD_LANGUAGE (                                                      
AD_LANGUAGE                                                                     
)                                                                               
ON DELETE CASCADE ;                                                             
ALTER TABLE W_STORE_TRL ADD                                                     
CONSTRAINT WSTORE_WSTORETRL                                                     
FOREIGN KEY (                                                                   
W_STORE_ID                                                                      
) REFERENCES W_STORE (                                                          
W_STORE_ID                                                                      
)                                                                               
ON DELETE CASCADE ;                                                             

--                                                                              
-- INDEXES --                                                                   
--                                                                              
CREATE INDEX AD_ATTACHMENT_RECORD ON
AD_ATTACHMENT (                            
AD_TABLE_ID,                                                                    
RECORD_ID                                                                       
);                                                                              
CREATE INDEX AD_CLIENT_NAME ON
AD_CLIENT (                                      
NAME                                                                            
);                                                                              
CREATE INDEX AD_COLUMN_NAME ON
AD_COLUMN (                                      
AD_TABLE_ID,                                                                    
COLUMNNAME                                                                      
);                                                                              
CREATE INDEX AD_ELEMENT_CLIENTORG ON
AD_ELEMENT (                               
AD_CLIENT_ID,                                                                   
AD_ORG_ID                                                                       
);                                                                              
CREATE INDEX AD_ELEMENT_COLUMNNAME ON
AD_ELEMENT (                              
COLUMNNAME                                                                      
);                                                                              
CREATE INDEX AD_ELEMENT_COMB ON
AD_ELEMENT (                                    
AD_ELEMENT_ID,                                                                  
SYS_NC00019$                                                                    
);                                                                              
CREATE INDEX AD_ELEMENT_NAME ON
AD_ELEMENT (                                    
NAME                                                                            
);                                                                              
CREATE INDEX AD_FIELDGROUP_KEY ON
AD_FIELDGROUP (                               
AD_FIELDGROUP_ID                                                                
);                                                                              
CREATE INDEX AD_FIELD_COLUMN ON
AD_FIELD (                                      
AD_TAB_ID,                                                                      
AD_COLUMN_ID                                                                    
);                                                                              
CREATE INDEX AD_IMPFORMAT_NAME ON
AD_IMPFORMAT (                                
NAME                                                                            
);                                                                              
CREATE INDEX AD_MESSAGE_VALUE ON
AD_MESSAGE (                                   
VALUE                                                                           
);                                                                              
CREATE INDEX AD_NOTE_KEY ON
AD_NOTE (                                           
AD_NOTE_ID                                                                      
);                                                                              
CREATE INDEX AD_ORG_VALUE ON
AD_ORG (                                           
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX AD_PINSTANCE_RECORD ON
AD_PINSTANCE (                              
AD_PROCESS_ID,                                                                  
RECORD_ID                                                                       
);                                                                              
CREATE INDEX AD_PREFERENCE_ATTRIBUTE ON
AD_PREFERENCE (                         
AD_CLIENT_ID,                                                                   
AD_ORG_ID,                                                                      
AD_WINDOW_ID,                                                                   
AD_USER_ID,                                                                     
ATTRIBUTE                                                                       
);                                                                              
CREATE INDEX AD_PRINTCOLOR_NAME ON
AD_PRINTCOLOR (                              
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX AD_PRINTFONT_NAME ON
AD_PRINTFONT (                                
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX AD_PRINTFORMATITEM_FORMAT ON
AD_PRINTFORMATITEM (                  
AD_PRINTFORMAT_ID                                                               
);                                                                              
CREATE INDEX AD_PRINTFORMAT_NAME ON
AD_PRINTFORMAT (                            
AD_CLIENT_ID,                                                                   
AD_TABLE_ID,                                                                    
NAME                                                                            
);                                                                              
CREATE INDEX AD_PRINTFORMAT_TABLE ON
AD_PRINTFORMAT (                           
AD_TABLE_ID                                                                     
);                                                                              
CREATE INDEX AD_PRINTFORM_CLIENT ON
AD_PRINTFORM (                              
AD_CLIENT_ID,                                                                   
AD_ORG_ID                                                                       
);                                                                              
CREATE INDEX AD_PRINTPAPER_NAME ON
AD_PRINTPAPER (                              
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX AD_PROCESS_PARA_PROCESS ON
AD_PROCESS_PARA (                       
AD_PROCESS_ID                                                                   
);                                                                              
CREATE INDEX AD_REFERENCE_NAME ON
AD_REFERENCE (                                
NAME                                                                            
);                                                                              
CREATE INDEX AD_REF_LIST_VALUE ON
AD_REF_LIST (                                 
AD_REFERENCE_ID,                                                                
VALUE                                                                           
);                                                                              
CREATE INDEX AD_SEQUENCE_NAME ON
AD_SEQUENCE (                                  
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX AD_TABLE_NAME ON
AD_TABLE (                                        
TABLENAME                                                                       
);                                                                              
CREATE INDEX AD_TAB_TABLE ON
AD_TAB (                                           
AD_TABLE_ID                                                                     
);                                                                              
CREATE INDEX AD_TAB_WINDOW ON
AD_TAB (                                          
AD_WINDOW_ID                                                                    
);                                                                              
CREATE INDEX AD_TASKINSTANCE_TASK ON
AD_TASKINSTANCE (                          
AD_TASK_ID                                                                      
);                                                                              
CREATE INDEX AD_TASK_NAME ON
AD_TASK (                                          
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX AD_TREENODEBP_PARENT ON
AD_TREENODEBP (                            
PARENT_ID                                                                       
);                                                                              
CREATE INDEX AD_TREENODEMM_PARENT ON
AD_TREENODEMM (                            
PARENT_ID                                                                       
);                                                                              
CREATE INDEX AD_TREENODEPR_PARENT ON
AD_TREENODEPR (                            
PARENT_ID                                                                       
);                                                                              
CREATE INDEX AD_TREENODE_PARENTID ON
AD_TREENODE (                              
PARENT_ID                                                                       
);                                                                              
CREATE INDEX AD_TREE_NAME ON
AD_TREE (                                          
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX AD_USER_EMAIL ON
AD_USER (                                         
EMAIL                                                                           
);                                                                              
CREATE INDEX AD_WF_ACTIVITY_ITEM ON
AD_WF_ACTIVITY (                            
AD_WF_PROCESS_ID,                                                               
AD_WF_NODE_ID                                                                   
);                                                                              
CREATE INDEX AD_WF_ACTIVITY_STATUS ON
AD_WF_ACTIVITY (                          
PROCESSED,                                                                      
WFSTATE                                                                         
);                                                                              
CREATE INDEX AD_WF_ACTIVITY_WHO ON
AD_WF_ACTIVITY (                             
AD_WF_RESPONSIBLE_ID,                                                           
AD_USER_ID                                                                      
);                                                                              
CREATE INDEX AD_WF_EVENTAUDIT_PARENT ON
AD_WF_EVENTAUDIT (                      
AD_WF_PROCESS_ID,                                                               
AD_WF_NODE_ID                                                                   
);                                                                              
CREATE INDEX AD_WF_NODE_WORKFLOW ON
AD_WF_NODE (                                
AD_WORKFLOW_ID                                                                  
);                                                                              
CREATE INDEX AD_WF_PROCESSDATA_PROCESS ON
AD_WF_PROCESSDATA (                   
AD_WF_PROCESS_ID                                                                
);                                                                              
CREATE INDEX AD_WF_PROCESS_WORKFLOW ON
AD_WF_PROCESS (                          
AD_WORKFLOW_ID                                                                  
);                                                                              
CREATE INDEX AD_WINDOW_NAME ON
AD_WINDOW (                                      
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX AD_WORKFLOW_NAME ON
AD_WORKFLOW (                                  
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_ACCTSCHEMA_ELEMENT_SCHEMA ON
C_ACCTSCHEMA_ELEMENT (              
C_ACCTSCHEMA_ID                                                                 
);                                                                              
CREATE INDEX C_ACCTSCHEMA_NAME ON
C_ACCTSCHEMA (                                
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_ACTIVITY_VALUE ON
C_ACTIVITY (                                   
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX C_ALLOCATIONLINE_INVOICE ON
C_ALLOCATIONLINE (                     
C_INVOICE_ID                                                                    
);                                                                              
CREATE INDEX C_ALLOCATIONLINE_PAYMENT ON
C_ALLOCATIONLINE (                     
C_PAYMENT_ID                                                                    
);                                                                              
CREATE INDEX C_BANKACCT_BANK ON
C_BANKACCOUNT (                                 
C_BANK_ID                                                                       
);                                                                              
CREATE INDEX C_BANKSTATEMENTLINE_PAYMENT ON
C_BANKSTATEMENTLINE (               
C_PAYMENT_ID                                                                    
);                                                                              
CREATE INDEX C_BANKSTMTLINE_BANKSTMT ON
C_BANKSTATEMENTLINE (                   
C_BANKSTATEMENT_ID                                                              
);                                                                              
CREATE INDEX C_BPARTNER_BPORG ON
C_BPARTNER (                                   
AD_ORGBP_ID                                                                     
);                                                                              
CREATE INDEX C_BPARTNER_NAME ON
C_BPARTNER (                                    
NAME                                                                            
);                                                                              
CREATE INDEX C_BPARTNER_VALUE ON
C_BPARTNER (                                   
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX C_BPBANKACCT_BPARTNER ON
C_BP_BANKACCOUNT (                        
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX C_BPLOCATION_BPARTNER ON
C_BPARTNER_LOCATION (                     
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX C_BPLOCATION_UPDATED ON
C_BPARTNER_LOCATION (                      
UPDATED                                                                         
);                                                                              
CREATE INDEX C_BP_GROUP_VALUE ON
C_BP_GROUP (                                   
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX C_CALENDAR_NAME ON
C_CALENDAR (                                    
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_CAMPAIGN_VALUE ON
C_CAMPAIGN (                                   
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX C_CASHLINE_CASH ON
C_CASHLINE (                                    
C_CASH_ID                                                                       
);                                                                              
CREATE INDEX C_CHANNEL_KEY ON
C_CHANNEL (                                       
C_CHANNEL_ID                                                                    
);                                                                              
CREATE INDEX C_CHANNEL_NAME ON
C_CHANNEL (                                      
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_CHARGE_NAME ON
C_CHARGE (                                        
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_COMMISSIONAMT_COMLINE ON
C_COMMISSIONAMT (                       
C_COMMISSIONLINE_ID                                                             
);                                                                              
CREATE INDEX C_COMMISSIONAMT_RUN ON
C_COMMISSIONAMT (                           
C_COMMISSIONRUN_ID                                                              
);                                                                              
CREATE INDEX C_COMMISSIONLINE_COMMISSION ON
C_COMMISSIONLINE (                  
C_COMMISSION_ID                                                                 
);                                                                              
CREATE INDEX C_CONVERSIONRATE_ONCE ON
C_CONVERSION_RATE (                       
AD_CLIENT_ID,                                                                   
AD_ORG_ID,                                                                      
C_CURRENCY_ID,                                                                  
C_CURRENCY_ID_TO,                                                               
C_CONVERSIONTYPE_ID,                                                            
VALIDFROM                                                                       
);                                                                              
CREATE INDEX C_COUNTRYCODE ON
C_COUNTRY (                                       
COUNTRYCODE                                                                     
);                                                                              
CREATE INDEX C_CURRENCYISOCODE ON
C_CURRENCY (                                  
ISO_CODE                                                                        
);                                                                              
CREATE INDEX C_CYCLE_NAME ON
C_CYCLE (                                          
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_DOCTYPE_NAME ON
C_DOCTYPE (                                      
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_ELEMENTVALUE_NAME ON
C_ELEMENTVALUE (                            
NAME                                                                            
);                                                                              
CREATE INDEX C_ELEMENTVALUE_VALUE ON
C_ELEMENTVALUE (                           
C_ELEMENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX C_ELEMENT_NAME ON
C_ELEMENT (                                      
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_INVOICELINE_INVOICE ON
C_INVOICELINE (                           
C_INVOICE_ID                                                                    
);                                                                              
CREATE INDEX C_INVOICELINE_ORDERLINE ON
C_INVOICELINE (                         
C_ORDERLINE_ID                                                                  
);                                                                              
CREATE INDEX C_INVOICELINE_PRODUCT ON
C_INVOICELINE (                           
M_PRODUCT_ID                                                                    
);                                                                              
CREATE INDEX C_INVOICEPAYSCHEDULE_INVOICE ON
C_INVOICEPAYSCHEDULE (             
C_INVOICE_ID                                                                    
);                                                                              
CREATE INDEX C_INVOICE_BPARTNER ON
C_INVOICE (                                  
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX C_INVOICE_DOCUMENTNO ON
C_INVOICE (                                
DOCUMENTNO,                                                                     
C_DOCTYPE_ID,                                                                   
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX C_INVOICE_KEY ON
C_INVOICE (                                       
C_INVOICE_ID                                                                    
);                                                                              
CREATE INDEX C_INVOICE_ORDER ON
C_INVOICE (                                     
C_ORDER_ID                                                                      
);                                                                              
CREATE INDEX C_INVOICE_PAID ON
C_INVOICE (                                      
AD_CLIENT_ID,                                                                   
ISPAID                                                                          
);                                                                              
CREATE INDEX C_ORDERLINE_ORDER ON
C_ORDERLINE (                                 
C_ORDER_ID                                                                      
);                                                                              
CREATE INDEX C_ORDERLINE_PRODUCT ON
C_ORDERLINE (                               
M_PRODUCT_ID                                                                    
);                                                                              
CREATE INDEX C_ORDER_BPARTNER ON
C_ORDER (                                      
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX C_ORDER_DOCUMENTNO ON
C_ORDER (                                    
DOCUMENTNO,                                                                     
C_DOCTYPE_ID,                                                                   
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX C_ORDER_PROCESSED ON
C_ORDER (                                     
AD_CLIENT_ID,                                                                   
PROCESSED                                                                       
);                                                                              
CREATE INDEX C_PAYMENTPROCESSOR_KEY ON
C_PAYMENTPROCESSOR (                     
C_PAYMENTPROCESSOR_ID                                                           
);                                                                              
CREATE INDEX C_PAYMENTTERM_NAME ON
C_PAYMENTTERM (                              
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_PAYMENT_BANKACCOUNT ON
C_PAYMENT (                               
C_BANKACCOUNT_ID                                                                
);                                                                              
CREATE INDEX C_PAYMENT_BPARTNER ON
C_PAYMENT (                                  
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX C_PAYSELLINE_PAYSEL ON
C_PAYSELECTIONLINE (                        
C_PAYSELECTION_ID                                                               
);                                                                              
CREATE INDEX C_PERIOD_NOUNIQUE ON
C_PERIOD (                                    
C_YEAR_ID,                                                                      
PERIODNO                                                                        
);                                                                              
CREATE INDEX C_PROJECT_VALUE ON
C_PROJECT (                                     
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX C_REGION_NAME ON
C_REGION (                                        
C_COUNTRY_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_REVENUERECOGNITION_KEY ON
C_REVENUERECOGNITION (                 
C_REVENUERECOGNITION_ID                                                         
);                                                                              
CREATE INDEX C_SALESREGION_VALUE ON
C_SALESREGION (                             
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX C_TAXCATEGORY_NAME ON
C_TAXCATEGORY (                              
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_TAX_KEY ON
C_TAX (                                               
C_TAX_ID                                                                        
);                                                                              
CREATE INDEX C_TAX_NAME ON
C_TAX (                                              
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_UOM_CONVERSION_PRODUCT ON
C_UOM_CONVERSION (                     
C_UOM_ID,                                                                       
C_UOM_TO_ID,                                                                    
M_PRODUCT_ID                                                                    
);                                                                              
CREATE INDEX C_UOM_NAME ON
C_UOM (                                              
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX C_UOM_X12 ON
C_UOM (                                               
X12DE355                                                                        
);                                                                              
CREATE INDEX C_VALIDCOMBINATION_ALIAS ON
C_VALIDCOMBINATION (                   
AD_CLIENT_ID,                                                                   
ALIAS                                                                           
);                                                                              
CREATE INDEX C_VALIDCOMBINATION_ALT ON
C_VALIDCOMBINATION (                     
C_ACCTSCHEMA_ID,                                                                
AD_ORG_ID,                                                                      
ACCOUNT_ID,                                                                     
M_PRODUCT_ID,                                                                   
C_BPARTNER_ID,                                                                  
AD_ORGTRX_ID,                                                                   
C_LOCFROM_ID,                                                                   
C_LOCTO_ID,                                                                     
C_SALESREGION_ID,                                                               
C_PROJECT_ID,                                                                   
C_CAMPAIGN_ID,                                                                  
C_ACTIVITY_ID,                                                                  
USER1_ID,                                                                       
USER2_ID                                                                        
);                                                                              
CREATE INDEX C_YEAR_NAME ON
C_YEAR (                                            
C_CALENDAR_ID,                                                                  
YEAR                                                                            
);                                                                              
CREATE INDEX FACT_ACCT_ACCOUNT ON
FACT_ACCT (                                   
AD_CLIENT_ID,                                                                   
AD_ORG_ID,                                                                      
C_ACCTSCHEMA_ID,                                                                
ACCOUNT_ID                                                                      
);                                                                              
CREATE INDEX FACT_ACCT_BALANCE_AKEY ON
FACT_ACCT_BALANCE (                      
AD_CLIENT_ID,                                                                   
AD_ORG_ID,                                                                      
C_ACCTSCHEMA_ID,                                                                
DATEACCT,                                                                       
ACCOUNT_ID,                                                                     
POSTINGTYPE,                                                                    
M_PRODUCT_ID,                                                                   
C_BPARTNER_ID,                                                                  
C_PROJECT_ID,                                                                   
AD_ORGTRX_ID,                                                                   
C_SALESREGION_ID,                                                               
C_ACTIVITY_ID,                                                                  
C_CAMPAIGN_ID,                                                                  
C_LOCTO_ID,                                                                     
C_LOCFROM_ID,                                                                   
USER1_ID,                                                                       
USER2_ID,                                                                       
GL_BUDGET_ID                                                                    
);                                                                              
CREATE INDEX FACT_ACCT_DATEACCT ON
FACT_ACCT (                                  
DATEACCT                                                                        
);                                                                              
CREATE INDEX GL_BUDGET_NAME ON
GL_BUDGET (                                      
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX GL_CATEGORY_NAME ON
GL_CATEGORY (                                  
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX GL_JOURNALBATCH_DOCNO ON
GL_JOURNALBATCH (                         
AD_ORG_ID,                                                                      
C_PERIOD_ID,                                                                    
DOCUMENTNO                                                                      
);                                                                              
CREATE INDEX GL_JOURNALLINE_KEY ON
GL_JOURNALLINE (                             
GL_JOURNALLINE_ID                                                               
);                                                                              
CREATE INDEX GL_JOURNAL_DOCNO ON
GL_JOURNAL (                                   
AD_ORG_ID,                                                                      
C_PERIOD_ID,                                                                    
DOCUMENTNO                                                                      
);                                                                              
CREATE INDEX MPC_MRP_PRODUCT ON
MPC_MRP (                                       
AD_CLIENT_ID,                                                                   
AD_ORG_ID,                                                                      
M_WAREHOUSE_ID,                                                                 
DATEPROMISED,                                                                   
M_PRODUCT_ID                                                                    
);                                                                              
CREATE INDEX MPC_ORDER_NODE_WORKFLOW ON
MPC_ORDER_NODE (                        
MPC_ORDER_ID                                                                    
);                                                                              
CREATE INDEX MPC_PCOSTING_ID ON
MPC_PRODUCT_COSTING (                           
MPC_PRODUCT_COSTING_ID                                                          
);                                                                              
CREATE INDEX MPC_PROFILEBOM_NAME ON
MPC_PROFILEBOM (                            
NAME                                                                            
);                                                                              
CREATE INDEX MPC_PROFILECOST_MPCPROFILEBOM ON
MPC_PROFILEBOMCOST (              
MPC_PROFILEBOM_ID                                                               
);                                                                              
CREATE INDEX M_BOM_PRODUCTVERSIONTYPE ON
M_BOM (                                
M_PRODUCT_ID,                                                                   
M_CHANGENOTICE_ID                                                               
);                                                                              
CREATE INDEX M_EDI_TRX ON
M_EDI (                                               
C_BP_EDI_ID,                                                                    
DOCUMENTNO,                                                                     
LINE                                                                            
);                                                                              
CREATE INDEX M_INOUTLINE_INOUT ON
M_INOUTLINE (                                 
M_INOUT_ID                                                                      
);                                                                              
CREATE INDEX M_INOUTLINE_PRODUCT ON
M_INOUTLINE (                               
M_PRODUCT_ID                                                                    
);                                                                              
CREATE INDEX M_INOUT_BPARTNER ON
M_INOUT (                                      
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX M_INOUT_DOCUMENTNO ON
M_INOUT (                                    
DOCUMENTNO                                                                      
);                                                                              
CREATE INDEX M_INOUT_ORDER ON
M_INOUT (                                         
C_ORDER_ID                                                                      
);                                                                              
CREATE INDEX M_INVENTORYLINE_PRODUCTLOCATTR ON
M_INVENTORYLINE (                
M_INVENTORY_ID,                                                                 
M_LOCATOR_ID,                                                                   
M_PRODUCT_ID,                                                                   
M_ATTRIBUTESETINSTANCE_ID                                                       
);                                                                              
CREATE INDEX M_LOCATION_WHERE ON
M_LOCATOR (                                    
M_WAREHOUSE_ID,                                                                 
X,                                                                              
Y,                                                                              
Z                                                                               
);                                                                              
CREATE INDEX M_MATCHINV_SHIP ON
M_MATCHINV (                                    
C_INVOICELINE_ID,                                                               
M_INOUTLINE_ID                                                                  
);                                                                              
CREATE INDEX M_MATCHPO_SHIP ON
M_MATCHPO (                                      
C_ORDERLINE_ID,                                                                 
M_INOUTLINE_ID                                                                  
);                                                                              
CREATE INDEX M_MOVEMENTLINE_MOVEMENT ON
M_MOVEMENTLINE (                        
M_MOVEMENT_ID                                                                   
);                                                                              
CREATE INDEX M_PRICELIST_NAME ON
M_PRICELIST (                                  
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX M_PRODUCTIONLINE_KEY ON
M_PRODUCTIONLINE (                         
M_PRODUCTIONLINE_ID                                                             
);                                                                              
CREATE INDEX M_PRODUCTIONLINE_PRODPLAN ON
M_PRODUCTIONLINE (                    
M_PRODUCTIONPLAN_ID                                                             
);                                                                              
CREATE INDEX M_PRODUCTIONPLAN_PRODUCTION ON
M_PRODUCTIONPLAN (                  
M_PRODUCTION_ID                                                                 
);                                                                              
CREATE INDEX M_PRODUCT_CATEGORY_VALUE ON
M_PRODUCT_CATEGORY (                   
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX M_PRODUCT_EXPENSETYPE ON
M_PRODUCT (                               
S_EXPENSETYPE_ID                                                                
);                                                                              
CREATE INDEX M_PRODUCT_NAME ON
M_PRODUCT (                                      
NAME                                                                            
);                                                                              
CREATE INDEX M_PRODUCT_PO_VENDORPRODNO ON
M_PRODUCT_PO (                        
C_BPARTNER_ID,                                                                  
VENDORPRODUCTNO                                                                 
);                                                                              
CREATE INDEX M_PRODUCT_PRODUCTCATEGORY ON
M_PRODUCT (                           
M_PRODUCT_CATEGORY_ID                                                           
);                                                                              
CREATE INDEX M_PRODUCT_RESOURCE ON
M_PRODUCT (                                  
S_RESOURCE_ID                                                                   
);                                                                              
CREATE INDEX M_PRODUCT_UPC ON
M_PRODUCT (                                       
UPC                                                                             
);                                                                              
CREATE INDEX M_PRODUCT_VALUE ON
M_PRODUCT (                                     
AD_CLIENT_ID,                                                                   
VALUE                                                                           
);                                                                              
CREATE INDEX M_SHIPPER_NAME ON
M_SHIPPER (                                      
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX M_TRANSACTIONALLOCATION_PRD ON
M_TRANSACTIONALLOCATION (           
M_PRODUCT_ID,                                                                   
M_ATTRIBUTESETINSTANCE_ID,                                                      
ISALLOCATED                                                                     
);                                                                              
CREATE INDEX M_TRANSSACTION_PRODUCT ON
M_TRANSACTION (                          
M_PRODUCT_ID                                                                    
);                                                                              
CREATE INDEX M_WAREHOUSE_NAME ON
M_WAREHOUSE (                                  
AD_CLIENT_ID,                                                                   
NAME                                                                            
);                                                                              
CREATE INDEX PA_ACHIEVEMENT_KEY ON
PA_ACHIEVEMENT (                             
PA_ACHIEVEMENT_ID                                                               
);                                                                              
CREATE INDEX R_CONTACTINTEREST_KEY ON
R_CONTACTINTEREST (                       
AD_USER_ID,                                                                     
R_INTERESTAREA_ID                                                               
);                                                                              
CREATE INDEX R_REQUEST_BPARTNER ON
R_REQUEST (                                  
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX R_REQUEST_USER ON
R_REQUEST (                                      
AD_USER_ID                                                                      
);                                                                              
CREATE INDEX W_BASKET_CBPARTNER ON
W_BASKET (                                   
C_BPARTNER_ID                                                                   
);                                                                              
CREATE INDEX W_BASKET_SESSION ON
W_BASKET (                                     
SESSION_ID                                                                      
);                                                                              
CREATE INDEX W_CLICKCOUNT_TARGETURL ON
W_CLICKCOUNT (                           
AD_CLIENT_ID,                                                                   
TARGETURL                                                                       
);                                                                              
CREATE INDEX W_COUNTERCOUNT_PAGEURL ON
W_COUNTERCOUNT (                         
AD_CLIENT_ID,                                                                   
PAGEURL                                                                         
);                                                                              
CREATE INDEX W_MAILMSG_WSTORE ON
W_MAILMSG (                                    
W_STORE_ID,                                                                     
MAILMSGTYPE                                                                     
);