Topic
  • 1 reply
  • Latest Post - ‏2014-07-16T17:17:37Z by Jan-Eike
AYAA_Cristina_Gonzalez_Zumelzu
1 Post

Pinned topic Problems with perios business_time

‏2014-07-11T10:21:54Z | business_time temporal

Hello,

 

I'm working with DB2 v10 for z/OS. I have two tables, one of them (TABLE1 ) with a primary key defined with period business_time "without overlaps" as following:

 

ALTER TABLE TABLE1 ADD CONSTRAINT TABLE1_PK PRIMARY KEY

(CAMPO1,

CAMPO2, BUSINESS_TIME WITHOUT OVERLAPS)

 I want to create a foreign key in the second table (TABLE2 ) as following:

 

ALTER TABLE TABLE2 ADD CONSTRAINT TABLE1_TABLE2_FK FOREIGN KEY

(CAMPO1,

CAMPO2)

REFERENCES TABLE1

(CAMPO1,

CAMPO2, BUSINESS_TIME WITHOUT OVERLAPS)

ON DELETE NO ACTION

NOT ENFORCED;

When I execute the second statement I get the next error code :

ILLEGAL USE OF KEYWORD WITHOUT.  TOKEN ,) WAS EXPECTED SQLCODE = -199 SQLSTATE=42601, DRIVER=4.12.79

If I omit the clause  BUSINESS_TIME WITHOUT OVERLAPS when I am creating the Foreign Key I get the following error code, obviously,:

FOREIGN KEY TABLE1_TABLE_FK DOES NOT CONFORM TO THE DESCRIPTION OF A PARENT KEY OF TABLE TABLE1. SQLCODE =-538 , SQLSTATE= 42830, DRIVER = 4.1279

 

Is NO posible to do that, to define a FK with a PK defined with BUSINESS_TIME WITHOUT OVERLAPS?

 

Thanks in advance.

 

Cristina