doc-exports/docs/dws/dev/dws_06_0215.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

39 lines
5.9 KiB
HTML

<a name="EN-US_TOPIC_0000001188588972"></a><a name="EN-US_TOPIC_0000001188588972"></a>
<h1 class="topictitle1">DROP VIEW</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001188588972__sc2f3652ea7884fc3a7f3abca9c5f6cf1"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001188588972__a20e99311d0f04a1bb6238024214baeab"><strong id="EN-US_TOPIC_0000001188588972__b3451148795250">DROP VIEW</strong> forcibly deletes an existing view in a database.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001188588972__s082eb90e82814f00af1a39510e0a64ba"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001188588972__ul151371327205519"><li id="EN-US_TOPIC_0000001188588972__li6138112715514">Only a view owner or a system administrator can run <strong id="EN-US_TOPIC_0000001188588972__b102883718">DROP VIEW</strong> command.</li><li id="EN-US_TOPIC_0000001188588972__li1351712292557">The database stores only the definition of a view, but does not store the data corresponding to the view. If the base table remains unchanged, you can run the <a href="dws_06_0187.html">CREATE VIEW</a> command to recreate a view that is deleted by mistake.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188588972__sc29df4fdf5e44ee79afcc0b3f8ccda44"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188588972__s2cf39d3a2f584a38b460750d10165a1b"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">VIEW</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">IF</span><span class="w"> </span><span class="k">EXISTS</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="n">view_name</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...]</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">CASCADE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">RESTRICT</span><span class="w"> </span><span class="p">];</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188588972__s49eade590b0f4b098e648dd1dc5e3e60"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001188588972__u94351f73b3e945628b8649a4f9cc4f3e"><li id="EN-US_TOPIC_0000001188588972__l0f4022fd0c8c4292bb53daf7a42b4b3a"><strong id="EN-US_TOPIC_0000001188588972__a1bd25568e8014178b379654d63fb7705">IF EXISTS</strong><p id="EN-US_TOPIC_0000001188588972__abe31db914a76494bb35d51948556b2ae">Sends a notice instead of an error if the specified view does not exist.</p>
</li><li id="EN-US_TOPIC_0000001188588972__l58e147705fc64066994924862c8f66e5"><strong id="EN-US_TOPIC_0000001188588972__ae3fcc2a08f584332b3815a5209776e1a">view_name</strong><p id="EN-US_TOPIC_0000001188588972__ab6d27b2b82d348be80745fa87fb975c7">Specifies the name of the view to be deleted.</p>
<p id="EN-US_TOPIC_0000001188588972__a9ee2ac78101e427f90c718c3df1d1e74">Value range: An existing view.</p>
</li><li id="EN-US_TOPIC_0000001188588972__l989e0a8054084ca298c3ace6caf0a0e3"><strong id="EN-US_TOPIC_0000001188588972__a34a807925f7149dabb660fa7b1691267">CASCADE | RESTRICT</strong><ul id="EN-US_TOPIC_0000001188588972__u8eb465a4e4954c04af52880c8d9012b8"><li id="EN-US_TOPIC_0000001188588972__l0aa57a277f334462bd49a59b13e64000"><strong id="EN-US_TOPIC_0000001188588972__b84235270693354">CASCADE</strong>: deletes objects (such as other views) that depend on a view to be deleted.</li><li id="EN-US_TOPIC_0000001188588972__l3fe8d9d9a85b49899dd42530dfeffcf5"><strong id="EN-US_TOPIC_0000001188588972__b84235270693358">RESTRICT</strong>: refuses to delete the view if any objects depend on it. This is the default.</li></ul>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001188588972__s974b31b9463848259512367e2d285b74"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001188588972__p3178173112910">Delete the <strong id="EN-US_TOPIC_0000001188588972__b108674338233513">myView</strong> view:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188588972__screen1325153613297"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">VIEW</span><span class="w"> </span><span class="n">myView</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001188588972__p382316395210">Delete the <strong id="EN-US_TOPIC_0000001188588972__b210688595933513">customer_details_view_v2</strong> view:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188588972__screen271532165817"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">DROP</span><span class="w"> </span><span class="k">VIEW</span><span class="w"> </span><span class="k">public</span><span class="p">.</span><span class="n">customer_details_view_v2</span><span class="p">;</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001188588972__s56e26682f0c24a8987ba07e3099ff0a9"><h4 class="sectiontitle">Helpful Links</h4><p id="EN-US_TOPIC_0000001188588972__a97753a2696fd49538504b71c38f5bece"><a href="dws_06_0150.html">ALTER VIEW</a>, <a href="dws_06_0187.html">CREATE VIEW</a></p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0118.html">DDL Syntax</a></div>
</div>
</div>