Previous Topic: -35 - TTM IS UNUSABLE: SQLCODE xxx, DB RC yy(zzz) ON INITIALIZATIONNext Topic: -37 - CONSTRAINT REBIND FAILED: A,B,C,D,E,F


-36 - BAD FOREIGN KEY: reason code,A,B,C,D,E,F,G

Reason:

The foreign key being created fails to satisfy all of the requirements for a foreign key. See the table below, for the specific problem.

The SQLSTATE that equates to this SQL return code is 53S03.

Action:

Interpret the error message using the chart below. If the error message has been truncated, run a DBUTLTY REPORT AREA=PXX for a complete error summary (search for the -36 error message). For more information on creating valid foreign keys, see CA Datacom/DB SQL User Guide.

Reason Code

Reason for Rejection
A thru F Description

 

1

SET NULL was specified but no foreign key columns are nullable.

  • A - Name of violating foreign key constraint.
  • B - AUTHID of A.
  • C - Nullable column required.

 

2

SET DEFAULT was specified but at least one of the columns lacks a default value specification.

  • A - Name of violating foreign key restraint.
  • B - Name of column missing the default.
  • C - AUTHID of A.
  • D - Default value(s) required.

 

3

ON DELETE actions conflict as described in the CA Datacom/DB SQL User Guide.

  • A - Name of the "common" parent table.
  • B - Name of the first foreign key involved in conflict.
  • C - Name of second foreign key involved in conflict.
  • D - 4 byte string indicating types of rule conflicts.
  • E - AUTHID of common parent table.
  • F - AUTHID of first foreign key.
  • G - AUTHID of second foreign key.

 

4

This foreign key references the table on which it is being defined. This is not allowed.

  • A - Name of the foreign key in violation.
  • B - AUTHID of the foreign key in violation.

 

5

This foreign key indirectly references the table on which it is being defined, or the definition of the new foreign key caused a different foreign key (possibly on a different table) to become self-referencing.

  • A - Name of table containing the foreign key being created.
  • B - Name of self-referencing foreign key.
  • C - AUTHID of table in A.
  • D - AUTHID of foreign key constraint in B.

 

Note: The four characters that appear in item D of reason code 3 indicate how the update and delete rules conflicted between the foreign keys named in items B and C. The first character is Y if the delete rules of B and C conflict. The second is Y if B's delete rule conflicts with C's update rule. The third is Y if B's update rule conflicts with C's delete rule. The fourth is Y if the two update rules conflict. In general, update and delete rules conflict if their actions are different (CASCADE and RESTRICT, for example) and an attempt could be made to take both actions on the same row at the same time. See the CA Datacom/DB SQL User Guide for a detailed description of which update and delete rules conflict.