77 lines
4.9 KiB
HTML
77 lines
4.9 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Check constraints" />
|
||
|
<meta name="abstract" content="You use check constraints to maintain limits on field values so that they conform to your database requirements." />
|
||
|
<meta name="description" content="You use check constraints to maintain limits on field values so that they conform to your database requirements." />
|
||
|
<meta name="DC.subject" content="constraint, check, check constraint" />
|
||
|
<meta name="keywords" content="constraint, check, check constraint" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbaforzahfcoa.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbaforzahfcon" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Check constraints</title>
|
||
|
</head>
|
||
|
<body id="rbaforzahfcon"><a name="rbaforzahfcon"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Check constraints</h1>
|
||
|
<div><p>You use check constraints to maintain limits on field values so
|
||
|
that they conform to your database requirements.</p>
|
||
|
<p>Check constraints ensure data validity during insert or update operations
|
||
|
by checking the data against a check constraint expression that you define.</p>
|
||
|
<p>For example, you can create a check constraint on a field and define that
|
||
|
the values that are inserted into the field must be between 1 and 100. If
|
||
|
a value does not fall within the range, the insert or update operation against
|
||
|
your database is not processed.</p>
|
||
|
<div class="p">Check constraints are much like referential constraints in terms of their
|
||
|
states: <ul><li><strong>Defined and enabled</strong>. The constraint definition has been added to
|
||
|
the file, and the constraint will be enforced after the constraint is established.</li>
|
||
|
<li><strong>Defined and disabled </strong>. The constraint definition has been added
|
||
|
to the file, but the constraint will not be enforced.</li>
|
||
|
<li><strong>Established and enabled</strong>. The constraint has been added to the file
|
||
|
and all of the pieces of the file are there for enforcement.</li>
|
||
|
<li><strong>Established and disabled</strong>. The constraint has been added to the
|
||
|
file and all of the pieces of the file are there for enforcement, but the
|
||
|
constraint will not be enforced.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p>A check constraint, like a referential constraint, can have a check pending
|
||
|
status. If the data in any field violates the check constraint expression,
|
||
|
then the constraint is in check pending status. For the insertion or update
|
||
|
of a record, if the data violates the check constraint expression, then the
|
||
|
insert or update operation is not allowed.</p>
|
||
|
<div class="p">A check constraint that contains one or more Large Object (LOB) fields
|
||
|
is restricted to a narrower range of operations than a check constraint without
|
||
|
LOB fields. When the check constraint includes one or more LOB fields, the
|
||
|
LOB fields can only be involved in direct comparisons to: <ul><li>Other LOB fields of the same type and same maximum length.</li>
|
||
|
<li>Literal values.</li>
|
||
|
<li>The null value.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<p>Operations known as derived operations, such as the Substring or Concat
|
||
|
operations, are not allowed against LOB fields in a check constraint. The
|
||
|
diagnostic message CPD32E6 will be sent when you try to add a
|
||
|
check constraint that attempts a derived operation against a LOB field.</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbaforzahfcoa.htm" title="A constraint is a restriction or limitation placed on a file to ensure that the data in your database remains consistent as you add, change, and remove records. These topics describe how to use constraints to ensure data consistency.">Control the integrity of your database with constraints</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|