forked from docs/doc-exports
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>
29 lines
3.1 KiB
HTML
29 lines
3.1 KiB
HTML
<a name="EN-US_TOPIC_0000001233628595"></a><a name="EN-US_TOPIC_0000001233628595"></a>
|
|
|
|
<h1 class="topictitle1">Row Expressions</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001233628595__a102b1d0932864dc395edc075be32cc54">Syntax:</p>
|
|
<p id="EN-US_TOPIC_0000001233628595__a691a3f4476ce4c3385030d964f9cf9bc"><em id="EN-US_TOPIC_0000001233628595__ac83555c17fdf4510ab59b78b2bbdcce6">row_constructor operator row_constructor</em></p>
|
|
<p id="EN-US_TOPIC_0000001233628595__a353cf789987e48459e596e5cc75fcbd8">Both sides of the row expression are row constructors. The values of both rows must have the same number of fields and they are compared with each other. The row comparison allows operators including =, <>, <, <=, and >= or a similar operator.</p>
|
|
<p id="EN-US_TOPIC_0000001233628595__a588aa7f506f448a2b76c5dff4f915996">The use of operators =<> is slightly different from other operators. If all fields of two rows are not empty and equal, the two rows are equal. If any field in two rows is not empty and not equal, the two rows are not equal. Otherwise, the comparison result is null.</p>
|
|
<p id="EN-US_TOPIC_0000001233628595__a8ae8adec64f54dda993a080197361825">For operators <, <=, >, and > =, the fields in rows are compared from left to right until a pair of fields that are not equal or are empty are detected. If the pair of fields contains at least one null value, the comparison result is null. Otherwise, the comparison result of this pair of fields is the final result.</p>
|
|
<p id="EN-US_TOPIC_0000001233628595__a1d9311a9fa78480c8ec789a0944fa3e4">For example:</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233628595__s58efeefa84d04cff8f13d139641501ee"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span>
|
|
<span class="normal">3</span>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="k">ROW</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="k">NULL</span><span class="p">)</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="k">ROW</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="k">RESULT</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="k">result</span>
|
|
<span class="c1">----------</span>
|
|
<span class="w"> </span><span class="n">t</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0069.html">Expressions</a></div>
|
|
</div>
|
|
</div>
|
|
|