doc-exports/docs/dws/dev/dws_06_0147.html
Lu, Huayi a24ca60074 DWS DEVELOPER 811 version
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2023-01-19 13:37:49 +00:00

46 lines
6.5 KiB
HTML

<a name="EN-US_TOPIC_0000001145510755"></a><a name="EN-US_TOPIC_0000001145510755"></a>
<h1 class="topictitle1">ALTER TRIGGER</h1>
<div id="body1551942823551"><div class="section" id="EN-US_TOPIC_0000001145510755__s11dbafd02fc245e8ab6884159af9fd0b"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001145510755__a14673df9357e4e28aaff1157cd3bde67"><strong id="EN-US_TOPIC_0000001145510755__b177371838063">ALTER TRIGGER</strong> modifies the definition of a trigger.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510755__s3885984ccb904e76a8b521140774edbb"><h4 class="sectiontitle">Precautions</h4><p id="EN-US_TOPIC_0000001145510755__a46e9880e43d943eeb7dacc9537d4e963">Only the owner of a table where a trigger is created and system administrators can run the <strong id="EN-US_TOPIC_0000001145510755__b357418472069">ALTER TRIGGER</strong> statement.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510755__s097e199c371040739945504301b7678d"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510755__s49960349d09943568d3fc82d29c074fc"><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">ALTER</span><span class="w"> </span><span class="k">TRIGGER</span><span class="w"> </span><span class="k">trigger_name</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="k">table_name</span><span class="w"> </span><span class="k">RENAME</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">new_name</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510755__s49eade590b0f4b098e648dd1dc5e3e60"><h4 class="sectiontitle">Parameter Description</h4><ul id="EN-US_TOPIC_0000001145510755__u94351f73b3e945628b8649a4f9cc4f3e"><li id="EN-US_TOPIC_0000001145510755__l58e147705fc64066994924862c8f66e5"><strong id="EN-US_TOPIC_0000001145510755__ae3fcc2a08f584332b3815a5209776e1a">trigger_name</strong><p id="EN-US_TOPIC_0000001145510755__ab6d27b2b82d348be80745fa87fb975c7">Specifies the name of the trigger to be modified.</p>
<p id="EN-US_TOPIC_0000001145510755__a9ee2ac78101e427f90c718c3df1d1e74">Value range: an existing trigger</p>
</li><li id="EN-US_TOPIC_0000001145510755__li11636184716594"><strong id="EN-US_TOPIC_0000001145510755__b10748195216598">table_name</strong><p id="EN-US_TOPIC_0000001145510755__p318211253564">Specifies the name of the table where the trigger to be modified is located.</p>
<p id="EN-US_TOPIC_0000001145510755__p185906551621">Value range: an existing table having a trigger</p>
</li><li id="EN-US_TOPIC_0000001145510755__li12515948132714"><strong id="EN-US_TOPIC_0000001145510755__b1068605218276">new_name</strong><p id="EN-US_TOPIC_0000001145510755__p13341238202719">Specifies the new name after modification.</p>
<p id="EN-US_TOPIC_0000001145510755__p917531510307">Value range: a string that complies with the identifier naming convention. A value contains a maximum of 63 characters and cannot be the same as other triggers on the same table.</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510755__s974b31b9463848259512367e2d285b74"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001145510755__p265461022110">Modified the trigger <strong id="EN-US_TOPIC_0000001145510755__b1234834473917">delete_trigger</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510755__screen2353163234"><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">ALTER</span><span class="w"> </span><span class="k">TRIGGER</span><span class="w"> </span><span class="n">delete_trigger</span><span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="n">test_trigger_src_tbl</span><span class="w"> </span><span class="k">RENAME</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="n">delete_trigger_renamed</span><span class="p">;</span><span class="w"></span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001145510755__p56541103211">Disable the trigger <strong id="EN-US_TOPIC_0000001145510755__b5458185511395">insert_trigger</strong>.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510755__screen156901714231"><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">ALTER</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">test_trigger_src_tbl</span><span class="w"> </span><span class="n">DISABLE</span><span class="w"> </span><span class="k">TRIGGER</span><span class="w"> </span><span class="n">insert_trigger</span><span class="p">;</span><span class="w"> </span>
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001145510755__p1165441018215">Disable all triggers on the <strong id="EN-US_TOPIC_0000001145510755__b11114884011">test_trigger_src_tbl</strong> table.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001145510755__screen149051232102214"><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">ALTER</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">test_trigger_src_tbl</span><span class="w"> </span><span class="n">DISABLE</span><span class="w"> </span><span class="k">TRIGGER</span><span class="w"> </span><span class="k">ALL</span><span class="p">;</span><span class="w"> </span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001145510755__s56e26682f0c24a8987ba07e3099ff0a9"><h4 class="sectiontitle">Helpful Links</h4><p id="EN-US_TOPIC_0000001145510755__a97753a2696fd49538504b71c38f5bece"><a href="dws_06_0184.html">CREATE TRIGGER</a>, <a href="dws_06_0212.html">DROP TRIGGER</a>, <a href="dws_06_0142.html">ALTER TABLE</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>