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

217 lines
11 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 (Distinct Type Privileges) statement,
GRANT (Distinct Type Privileges), SQL statements, ALL clause,
ALL PRIVILEGES clause, ALTER clause, USAGE clause, ON TYPE clause,
in GRANT (Distinct Type Privileges) statement, authorization-name, PUBLIC clause,
WITH GRANT OPTION clause" />
<title>GRANT (Distinct Type 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="gntudtp"></a>
<h2 id="gntudtp"><a href="rbafzmst02.htm#ToC_1105">GRANT (Distinct Type Privileges)</a></h2><a id="idx2773" name="idx2773"></a><a id="idx2774" name="idx2774"></a>
<p>This form of the GRANT statement grants privileges on a distinct type.</p>
<a name="wq1543"></a>
<h3 id="wq1543"><a href="rbafzmst02.htm#ToC_1106">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="wq1544"></a>
<h3 id="wq1544"><a href="rbafzmst02.htm#ToC_1107">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 distinct type identified in the statement:
<ul>
<li>Every privilege specified in the statement</li>
<li>The system authority of *OBJMGT on the distinct type</li>
<li>The system authority *EXECUTE on the library containing the distinct type</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 distinct type</li>
<li>Administrative authority</li></ul>
<a name="wq1545"></a>
<h3 id="wq1545"><a href="rbafzmst02.htm#ToC_1108">Syntax</a></h3>
<a href="rbafzmstgntudtp.htm#synsgrantt"><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="rbafzmstsyn347.htm"
border="0" /></span><a href="#skipsyn-346"><img src="c.gif" alt="Skip visual syntax diagram"
border="0" /></a> .-PRIVILEGES-.
>>-GRANT--+-ALL--+------------+-+------------------------------->
| .-,---------. |
| V | |
'---+-ALTER-+-+-------'
'-USAGE-'
.-,------------------.
.-DISTINCT-. V |
>--ON--+----------+--TYPE----<span class="italic">distinct-type-name</span>-+--------------->
.-,----------------------.
V |
>--TO----+-<span class="italic">authorization-name</span>-+-+--+-------------------+------->&lt;
'-PUBLIC-------------' '-WITH GRANT OPTION-'
</pre>
<a name="skipsyn-346" id="skipsyn-346"></a>
<a name="synsgrantt"></a>
<h3 id="synsgrantt"><a href="rbafzmst02.htm#ToC_1109">Description</a></h3>
<dl class="parml">
<dt class="bold">ALL <span class="base">or</span> ALL PRIVILEGES</dt><a id="idx2775" name="idx2775"></a><a id="idx2776" name="idx2776"></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 distinct types. Note that granting ALL PRIVILEGES on a distinct type 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="idx2777" name="idx2777"></a>
<dd>Grants the privilege to use the COMMENT statement.
</dd>
<dt class="bold">USAGE </dt><a id="idx2778" name="idx2778"></a>
<dd>Grants the privilege to use the distinct type in tables, functions, or procedures.
</dd>
<dt class="bold">ON DISTINCT TYPE <var class="pv">distinct-type-name</var> </dt><a id="idx2779" name="idx2779"></a>
<dd>Identifies the distinct types on which the privilege is granted. The <span class="italic">distinct-type-name</span> must
identify a distinct type 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="idx2780" name="idx2780"></a>
<dd>Lists one or more authorization IDs.
</dd>
<dt class="bold">PUBLIC </dt><a id="idx2781" name="idx2781"></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="idx2782" name="idx2782"></a>
<dd>Allows the specified <span class="italic">authorization-names</span> to
grant privileges on the distinct types 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="wq1546"></a>
<h3 id="wq1546"><a href="rbafzmst02.htm#ToC_1110">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="wq1547"></a>
<table id="wq1547" width="100%" summary="" border="1" frame="border" rules="all">
<caption>Table 60. Privileges Granted to or Revoked from Distinct Types</caption>
<thead valign="bottom">
<tr>
<th id="wq1548" width="50%" align="left" valign="bottom">SQL Privilege</th>
<th id="wq1549" width="50%" align="left" valign="bottom">Corresponding System Authorities when
Granting to or Revoking from a Distinct Type</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1548">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="wq1549">
<div class="lines">*OBJALTER<br />
*OBJOPR<br />
*EXECUTE<br />
*OBJMGT (Revoke only)<br />
</div></td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1548">ALTER</td>
<td align="left" valign="top" headers="wq1549">*OBJALTER</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1548">USAGE</td>
<td align="left" valign="top" headers="wq1549">
<div class="lines">*EXECUTE<br />
*OBJOPR<br />
</div></td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1548">WITH GRANT OPTION</td>
<td align="left" valign="top" headers="wq1549">*OBJMGT</td>
</tr>
</tbody>
</table>
<a name="eqtabled"></a>
<p id="eqtabled"><span class="bold">Corresponding System Authorities When Checking Privileges to
a Distinct Type:</span> The following table describes the system authorities that correspond
to the SQL privileges when checking privileges to a distinct type. The left column
lists the SQL privilege. The right column lists the equivalent system authorities.</p>
<a name="wq1550"></a>
<table id="wq1550" width="100%" summary="" border="1" frame="border" rules="all">
<caption>Table 61. Corresponding System Authorities When Checking Privileges to a Distinct Type</caption>
<thead valign="bottom">
<tr>
<th id="wq1551" width="50%" align="left" valign="bottom">SQL Privilege</th>
<th id="wq1552" width="50%" align="left" valign="bottom">Corresponding System Authorities when
Granting to or Revoking from a Distinct Type</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq1551">ALTER</td>
<td align="left" valign="top" headers="wq1552">*OBJALTER</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq1551">USAGE</td>
<td align="left" valign="top" headers="wq1552">
<div class="lines">*EXECUTE and *OBJOPR<br />
</div></td>
</tr>
</tbody>
</table>
<p><span class="bold">When USAGE privilege is required:</span> USAGE
privilege is required when a distinct type is explicitly referenced in an
SQL statement. For example, in a statement that contains a CAST specification
or in a CREATE TABLE statement. The USAGE privilege is not required when a
distinct type is indirectly referenced. For example, when a view references
a column of a table that has a distinct data type.</p>
<p><span class="bold">Syntax alternatives:</span> The following keywords are synonyms
supported for compatibility to prior releases. These keywords are non-standard
and should not be used:</p>
<ul>
<li>The keyword DATA can be used as a synonym for DISTINCT.</li></ul>
<a name="wq1553"></a>
<h3 id="wq1553"><a href="rbafzmst02.htm#ToC_1111">Example</a></h3>
<p>Grant the USAGE privilege on distinct type SHOE_SIZE to user JONES. This
GRANT statement does not give JONES the privilege to execute the cast functions
that are associated with the distinct type SHOE_SIZE. </p>
<pre class="xmp"><span class="bold">GRANT USAGE</span>
<span class="bold">ON DISTINCT TYPE</span> SHOE_SIZE
<span class="bold">TO</span> JONES</pre><a id="idx2783" name="idx2783"></a><a id="idx2784" name="idx2784"></a>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstgetdiag.htm">Previous Page</a> | <a href="rbafzmstgntprc.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>