How to model a relationship with variable tables (polymorphism)?
There seem to be 2 main ways to model such a situation: 

(1) Use supertype/subtypes.  However, as we are not discussing "object oriented" design, the second option may be a bit more appropriate. 

(2) Use a so-called ARC, which expresses a XOR relationship. 

Suppose we have an entity TRANSACTION.  Each customer can be involved in one ore more transactions AND a customer is either a COMPANY or a PERSON (XOR).
Our ERD/relational model could look something like the ones below.  Notice the "arc", that is drawn across both relationships.




As for the implementation: you can code a CHECK constraint (in order to avoid triggers), which will enforce the XOR (exclusive or).  The complete DDL code looks something like this (notice the CHECK):

CREATE TABLE company ( 
  c_id NUMBER PRIMARY KEY
);

CREATE TABLE person ( 
  p_id NUMBER PRIMARY KEY
);

CREATE TABLE transaction ( 
  t_id NUMBER PRIMARY KEY
, c_id NUMBER 
, p_id NUMBER
);

ALTER TABLE transaction 
ADD CONSTRAINT fkarc CHECK (
     ( (c_id IS NOT NULL) AND (p_id IS NULL) ) 
  OR ( (p_id IS NOT NULL) AND (c_id IS NULL) ) 
);

ALTER TABLE transaction
ADD CONSTRAINT transaction_company_fk 
FOREIGN KEY ( c_id ) REFERENCES COMPANY ( c_id ) ;

ALTER TABLE transaction
ADD CONSTRAINT transaction_person_fk
FOREIGN KEY ( p_id ) REFERENCES PERSON ( p_id ) ;


(Tested on Oracle 12c)