80 lines
5.3 KiB
HTML
80 lines
5.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="reference" />
|
||
|
<meta name="DC.Title" content="WITH LOCAL CHECK OPTION" />
|
||
|
<meta name="abstract" content="The WITH LOCAL CHECK OPTION clause is identical to the WITH CASCADED CHECK OPTION clause except that you can update a row so that it no longer can be retrieved through the view. This can only happen when the view is directly or indirectly dependent on a view that was defined with no WITH CHECK OPTION clause." />
|
||
|
<meta name="description" content="The WITH LOCAL CHECK OPTION clause is identical to the WITH CASCADED CHECK OPTION clause except that you can update a row so that it no longer can be retrieved through the view. This can only happen when the view is directly or indirectly dependent on a view that was defined with no WITH CHECK OPTION clause." />
|
||
|
<meta name="DC.subject" content="CREATE VIEW statement, WITH LOCAL CHECK OPTION, view, WITH LOCAL CHECK" />
|
||
|
<meta name="keywords" content="CREATE VIEW statement, WITH LOCAL CHECK OPTION, view, WITH LOCAL CHECK" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafywcohdg.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="rbafywithlocalcheck" />
|
||
|
<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>WITH LOCAL CHECK OPTION</title>
|
||
|
</head>
|
||
|
<body id="rbafywithlocalcheck"><a name="rbafywithlocalcheck"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">WITH LOCAL CHECK OPTION</h1>
|
||
|
<div><p>The WITH LOCAL CHECK OPTION clause is identical to the WITH CASCADED
|
||
|
CHECK OPTION clause except that you can update a row so that it no longer
|
||
|
can be retrieved through the view. This can only happen when the view is directly
|
||
|
or indirectly dependent on a view that was defined with no WITH CHECK OPTION
|
||
|
clause.</p>
|
||
|
<div class="section"><p>For example, consider the same updatable view used in the previous
|
||
|
example:</p>
|
||
|
<pre> <strong>CREATE VIEW</strong> V1 <strong>AS SELECT</strong> COL1
|
||
|
<strong>FROM</strong> T1 <strong>WHERE</strong> COL1 > 10</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>Create second view over V1, this time specifying WITH LOCAL CHECK
|
||
|
OPTION:</p>
|
||
|
<pre> <strong>CREATE VIEW</strong> V2 <strong>AS SELECT</strong> COL1
|
||
|
<strong>FROM</strong> V1 <strong>WITH LOCAL CHECK OPTION</strong></pre>
|
||
|
</div>
|
||
|
<div class="section"><p>The same INSERT statement that failed in the previous CASCADED
|
||
|
CHECK OPTION example succeeds now because V2 does not have any search conditions,
|
||
|
and the search conditions of V1 do not need to be checked since V1 does not
|
||
|
specify a check option.</p>
|
||
|
<pre> <strong>INSERT INTO</strong> V2 <strong>VALUES</strong> (5)</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>Consider one more view created over V2:</p>
|
||
|
<pre> <strong>CREATE VIEW</strong> V3 <strong>AS SELECT</strong> COL1
|
||
|
<strong>FROM</strong> V2 <strong>WHERE</strong> COL1 < 100</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>The following INSERT is successful again because the search condition
|
||
|
on V1 is not checked due to the WITH LOCAL CHECK OPTION on V2, versus the
|
||
|
WITH CASCADED CHECK OPTION in the previous example. </p>
|
||
|
<pre> <strong>INSERT INTO</strong> V3 <strong>VALUES</strong> (5)</pre>
|
||
|
</div>
|
||
|
<div class="section"><p>The difference between LOCAL and CASCADED CHECK OPTION lies in
|
||
|
how many of the dependent views' search conditions are checked when a row
|
||
|
is inserted or updated. </p>
|
||
|
<ul><li>WITH LOCAL CHECK OPTION specifies that the search conditions of only those
|
||
|
dependent views that have the WITH LOCAL CHECK OPTION or WITH CASCADED CHECK
|
||
|
OPTION are checked when a row is inserted or updated.</li>
|
||
|
<li>WITH CASCADED CHECK OPTION specifies that the search conditions of all
|
||
|
dependent views are checked when a row is inserted or updated.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafywcohdg.htm" title="WITH CHECK OPTION is an optional clause on the CREATE VIEW statement that specifies the level of checking to be done when inserting or updating data through a view. If the option is specified, every row that is inserted or updated through the view must conform to the definition of that view.">WITH CHECK OPTION on a View</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|