102 lines
6.3 KiB
HTML
102 lines
6.3 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="Set up constraints for your database" />
|
|
<meta name="abstract" content="You can use physical file constraints to control the integrity of the data that is maintained in your database. You can also add constraints using iSeries Navigator." />
|
|
<meta name="description" content="You can use physical file constraints to control the integrity of the data that is maintained in your database. You can also add constraints using iSeries Navigator." />
|
|
<meta name="DC.Relation" scheme="URI" content="rbaforzahfcoa.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../cl/addpfcst.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmst02.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../sqlp/rbafykickoff.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../rzatc/rzatcgetstartinav.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmsthctabl.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../db2/rbafzmstatabl.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="rbaforzahfcod" />
|
|
<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>Set up constraints for your database</title>
|
|
</head>
|
|
<body id="rbaforzahfcod"><a name="rbaforzahfcod"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Set up constraints for your database</h1>
|
|
<div><p>You can use physical file constraints to control the integrity
|
|
of the data that is maintained in your database. You can also add constraints
|
|
using iSeries™ Navigator.</p>
|
|
<div class="p">To add a physical file constraint, use the Add Physical File Constraint
|
|
(ADDPFCST) command. <ul><li>To add a unique constraint, specify a value of *UNQCST on the Type parameter.
|
|
You must also specify one or more field names for the Key parameter.</li>
|
|
<li>To add a primary key constraint, specify a value of *PRIKEY on the Type
|
|
parameter. The key that you specify on the command becomes the primary access
|
|
path of the file. If the file does not have a keyed access path that can be
|
|
shared, the system creates one. You must also specify one or more field names
|
|
for the Key parameter.</li>
|
|
<li>To add a check constraint, specify a value of *CHKCST on the Type parameter.
|
|
You must also specify a check constraint expression on the CHKCST parameter.
|
|
The check constraint expression has the same syntax as the expression used
|
|
for check-conditions that are defined using Structured Query Language (SQL).
|
|
For information about using SQL to set up constraints, see DB2
|
|
Universal Database™ for iSeries SQL Reference.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="p">You can also add constraints using iSeries Navigator. See the following
|
|
topics in the SQL programming topic:<ul><li>Add key constraints using iSeries Navigator</li>
|
|
<li>Add check constraints using iSeries Navigator</li>
|
|
</ul>
|
|
</div>
|
|
<p>You can also add constraints when using the SQL CREATE TABLE and ALTER
|
|
TABLE statements.</p>
|
|
<div class="section" id="rbaforzahfcod__rbaforzahfcoe"><a name="rbaforzahfcod__rbaforzahfcoe"><!-- --></a><h4 class="sectiontitle">Rules for setting up constraints</h4><div class="p">Here
|
|
is a list of rules that apply to all physical file constraints.<ul><li>The file must be a physical file.</li>
|
|
<li>A file can have a maximum of one member, MAXMBR(1).</li>
|
|
<li>A constraint can be defined when the file has zero members. A constraint
|
|
cannot be established, however, until the file has one, and only one, member.</li>
|
|
<li>A file can have a maximum of one primary key constraint, but might have
|
|
many unique constraints.</li>
|
|
<li>There is a maximum of 300 constraint relations per file. This maximum
|
|
value is the sum of the following constraints: <ul><li>The unique constraints</li>
|
|
<li>The primary key constraint</li>
|
|
<li>The check constraints</li>
|
|
<li>The referential constraints, whether they are participating as a parent
|
|
or a dependent, and whether the constraints are defined or established.</li>
|
|
</ul>
|
|
</li>
|
|
<li>Constraint names must be unique in a library.</li>
|
|
<li>Constraints cannot be added to files in the QTEMP library.</li>
|
|
<li>Referential constraints must have the parent and dependent file in the
|
|
same auxiliary storage pool (ASP).</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</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 class="relconcepts"><strong>Related concepts</strong><br />
|
|
<div><a href="../db2/rbafzmst02.htm">DB2 UDB for iSeries SQL Reference</a></div>
|
|
<div><a href="../sqlp/rbafykickoff.htm">SQL programming</a></div>
|
|
<div><a href="../rzatc/rzatcgetstartinav.htm">Get started with iSeries Navigator</a></div>
|
|
</div>
|
|
<div class="relref"><strong>Related reference</strong><br />
|
|
<div><a href="../cl/addpfcst.htm">Add Physical File Constraint (ADDPFCST) command</a></div>
|
|
<div><a href="../db2/rbafzmsthctabl.htm">CREATE TABLE</a></div>
|
|
<div><a href="../db2/rbafzmstatabl.htm">ALTER TABLE</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |