ibm-information-center/dist/eclipse/plugins/i5OS.ic.db2_5.4.0.1/rbafzmstgntseqp.htm

216 lines
9.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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="dc.language" scheme="rfc1766" 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. -->
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<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="keywords" content="GRANT (Sequence Privileges) statement,
GRANT (Sequence Privileges), SQL statements, ALL clause, ALL PRIVILEGES clause,
ALTER clause, USAGE clause, ON SEQUENCE clause,
in GRANT (Sequence Privileges) statement, authorization-name, PUBLIC clause,
WITH GRANT OPTION clause" />
<title>GRANT (Sequence Privileges)</title>
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
<link rel="stylesheet" type="text/css" href="ic.css" />
</head>
<body>
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
<a name="gntseqp"></a>
<h2 id="gntseqp"><a href="rbafzmst02.htm#ToC_1126">GRANT (Sequence Privileges)</a></h2><a id="idx2815" name="idx2815"></a><a id="idx2816" name="idx2816"></a>
<p>This form of the GRANT statement grants privileges on a sequence.</p>
<a name="wq1588"></a>
<h3 id="wq1588"><a href="rbafzmst02.htm#ToC_1127">Invocation</a></h3>
<p>This statement can be embedded in an application program or issued interactively.
It is an executable statement that can be dynamically prepared.</p>
<a name="wq1589"></a>
<h3 id="wq1589"><a href="rbafzmst02.htm#ToC_1128">Authorization</a></h3>
<p>The privileges held by the authorization ID of the statement must include
at least one of the following: </p>
<ul>
<li>For each sequence identified in the statement:
<ul>
<li>Every privilege specified in the statement</li>
<li>The system authority of *OBJMGT on the sequence</li>
<li>The system authority *EXECUTE on the library containing the sequence</li></ul></li>
<li>Administrative authority</li></ul>
<p>If WITH GRANT OPTION is specified, the privileges held by the authorization
ID of the statement must include at least one of the following: </p>
<ul>
<li>Ownership of the sequence</li>
<li>Administrative authority</li></ul>
<a name="wq1590"></a>
<h3 id="wq1590"><a href="rbafzmst02.htm#ToC_1129">Syntax</a></h3>
<a href="rbafzmstgntseqp.htm#synsgrants"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
<p>&nbsp;</p>
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn353.htm"
border="0" /></span><a href="#skipsyn-352"><img src="c.gif" alt="Skip visual syntax diagram"
border="0" /></a> .-PRIVILEGES-.
>>-GRANT--+-ALL--+------------+-+------------------------------->
| .-,---------. |
| V | |
'---+-ALTER-+-+-------'
'-USAGE-'
.-,-------------.
V |
>--ON--SEQUENCE----<span class="italic">sequence-name</span>-+------------------------------>
.-,----------------------.
V |
>--TO----+-<span class="italic">authorization-name</span>-+-+--+-------------------+------->&lt;
'-PUBLIC-------------' '-WITH GRANT OPTION-'
</pre>
<a name="skipsyn-352" id="skipsyn-352"></a>
<a name="synsgrants"></a>
<h3 id="synsgrants"><a href="rbafzmst02.htm#ToC_1130">Description</a></h3>
<dl class="parml">
<dt class="bold">ALL <span class="base">or</span> ALL PRIVILEGES</dt><a id="idx2817" name="idx2817"></a><a id="idx2818" name="idx2818"></a>
<dd>Grants one or more privileges. The privileges granted are all those
grantable privileges that the authorization ID of the statement has on the
specified sequences. Note that granting ALL PRIVILEGES on a sequence is not
the same as granting the system authority of *ALL.
<p>If you do not use ALL,
you must use one or more of the keywords listed below. Each keyword grants
the privilege described.</p>
</dd>
<dt class="bold">ALTER </dt><a id="idx2819" name="idx2819"></a>
<dd>Grants the privilege to use the ALTER SEQUENCE, COMMENT, and LABEL statements
on a sequence.
</dd>
<dt class="bold">USAGE </dt><a id="idx2820" name="idx2820"></a>
<dd>Grants the privilege to use the sequence in NEXT VALUE or PREVIOUS VALUE
expressions.
</dd>
<dt class="bold">ON SEQUENCE <var class="pv">sequence-name</var> </dt><a id="idx2821" name="idx2821"></a>
<dd>Identifies the sequences on which the privilege is granted. The <span class="italic">sequence-name</span> must identify a sequence that exists at
the current server.
</dd>
<dt class="bold">TO</dt>
<dd>Indicates to whom the privileges are granted.
<dl class="parml">
<dt class="bold"><var class="pv">authorization-name,...</var> </dt><a id="idx2822" name="idx2822"></a>
<dd>Lists one or more authorization IDs.
</dd>
<dt class="bold">PUBLIC </dt><a id="idx2823" name="idx2823"></a>
<dd>Grants the privileges to a set of users (authorization IDs). For more
information, see <a href="rbafzmstauthown.htm#authown">Authorization, privileges and object ownership</a>.
</dd>
</dl>
</dd>
<dt class="bold">WITH GRANT OPTION </dt><a id="idx2824" name="idx2824"></a>
<dd>Allows the specified <span class="italic">authorization-names</span> to
grant privileges on the sequences specified in the ON clause to other users.
<p>If WITH GRANT OPTION is omitted, the specified <span class="italic">authorization-names</span> cannot grant the USAGE privilege to others unless they have received
that authority from some other source (for example, from a grant of the system
authority *OBJMGT).</p>
</dd>
</dl>
<a name="wq1591"></a>
<h3 id="wq1591"><a href="rbafzmst02.htm#ToC_1131">Note</a></h3>
<p><span class="bold">Corresponding System Authorities:</span> GRANT and REVOKE
statements assign and remove system authorities for SQL objects. The following
table describes the system authorities that correspond to the SQL privileges:</p>
<a name="wq1592"></a>
<table id="wq1592" width="100%" summary="" border="1" frame="border" rules="all">
<caption>Table 68. Privileges Granted to or Revoked from Sequences</caption>
<thead valign="bottom">
<tr>
<th id="wq1593" width="50%" align="left" valign="bottom">SQL Privilege</th>
<th id="wq1594" width="50%" align="left" valign="bottom">Corresponding System Authorities when
Granting to or Revoking from a Sequence</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1593">ALL (Grant or revoke of ALL grants or revokes
only those privileges the authorization ID of the statement has)</td>
<td align="left" valign="top" headers="wq1594">
<div class="lines">*OBJALTER<br />
*OBJOPR<br />
*EXECUTE<br />
*READ<br />
*ADD<br />
*DLT<br />
*UPD<br />
*OBJMGT (Revoke only)<br />
</div></td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1593">ALTER</td>
<td align="left" valign="top" headers="wq1594">*OBJALTER</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1593">USAGE</td>
<td align="left" valign="top" headers="wq1594">
<div class="lines">*OBJOPR<br />
*EXECUTE<br />
*READ<br />
*ADD<br />
*DLT<br />
*UPD<br />
</div></td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1593">WITH GRANT OPTION</td>
<td align="left" valign="top" headers="wq1594">*OBJMGT</td>
</tr>
</tbody>
</table>
<a name="eqtables"></a>
<p id="eqtables"><span class="bold">Corresponding System Authorities When Checking Privileges to
a Sequence:</span> The following table describes the system authorities that
correspond to the SQL privileges when checking privileges to a sequence. The
left column lists the SQL privilege. The right column lists the equivalent
system authorities.</p>
<a name="wq1595"></a>
<table id="wq1595" width="100%" summary="" border="1" frame="border" rules="all">
<caption>Table 69. Corresponding System Authorities When Checking Privileges to a Sequence</caption>
<thead valign="bottom">
<tr>
<th id="wq1596" width="50%" align="left" valign="bottom">SQL Privilege</th>
<th id="wq1597" width="50%" align="left" valign="bottom">Corresponding System Authorities</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1596">ALTER</td>
<td align="left" valign="top" headers="wq1597">*OBJALTER</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1596">USAGE</td>
<td align="left" valign="top" headers="wq1597">
<div class="lines">*OBJOPR and *EXECUTE and<br />
*READ and *ADD and<br />
*DLT and *UPD<br />
</div></td>
</tr>
</tbody>
</table>
<a name="wq1598"></a>
<h3 id="wq1598"><a href="rbafzmst02.htm#ToC_1132">Example</a></h3>
<p>Grant any user the USAGE privilege on a sequence called ORG_SEQ.</p>
<pre class="xmp"><span class="bold">GRANT USAGE</span>
<span class="bold">ON SEQUENCE</span> ORG_SEQ
<span class="bold">TO PUBLIC</span></pre><a id="idx2825" name="idx2825"></a><a id="idx2826" name="idx2826"></a>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstgntpp.htm">Previous Page</a> | <a href="rbafzmstgnt.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
<a href="rbafzmstindex.htm#index">Index</a> ]
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
</body>
</html>