Note that there are some explanatory texts on larger screens.

plurals
  1. POFailed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
    primarykey
    data
    text
    <p>I make an outer join and executed successfully in the <code>informix</code> database but I get the following exception in my code:</p> <pre><code>DataTable dt = TeachingLoadDAL.GetCoursesWithEvalState(i, bat); </code></pre> <blockquote> <p>Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.</p> </blockquote> <p>I know the problem, but I don't know how to fix it.</p> <p>The second table I make the outer join on contains a composite primary key which are null in the previous outer join query.</p> <p><strong>EDIT:</strong></p> <pre><code> SELECT UNIQUE a.crs_e, a.crs_e || '/ ' || a.crst crs_name, b.period, b.crscls, c.crsday, c.from_lect, c.to_lect, c.to_lect - c.from_lect + 1 Subtraction, c.lect_kind, e.eval, e.batch_no, e.crsnum, e.lect_code, e.prof_course FROM rlm1course a, rfc14crsgrp b, ckj1table c, mnltablelectev d, OUTER(cc1assiscrseval e) WHERE a.crsnum = b.crsnum AND b.crsnum = c.crsnum AND b.crscls = c.crscls AND b.batch_no = c.batch_no AND c.serial_key = d.serial_key AND c.crsnum = e.crsnum AND c.batch_no = e.batch_no AND d.lect_code= e.lect_code AND d.lect_code = .... AND b.batch_no = .... </code></pre> <p>The problem happens with the table <code>cc1assiscrseval</code>. The primary key is (batch_no, crsnum, lect_code).</p> <p>How to fix this problem?</p> <hr> <p><strong>EDIT:</strong></p> <p>According to <code>@PaulStock</code> advice: I do what he said, and i get:</p> <blockquote> <p>? dt.GetErrors()[0] {System.Data.DataRow} HasErrors: true ItemArray: {object[10]} RowError: "Column 'eval' does not allow DBNull.Value."</p> </blockquote> <p>So I solve my problem by replacing <code>e.eval</code> to ,<code>NVL (e.eval,'') eval</code>.and this solves my problem. Thanks a lot.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload