forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
35 lines
2.3 KiB
HTML
35 lines
2.3 KiB
HTML
<a name="dli_08_0206"></a><a name="dli_08_0206"></a>
|
|
|
|
<h1 class="topictitle1">Table-Valued Functions</h1>
|
|
<div id="body1574406512527"><p id="dli_08_0206__p189103120151">Table-valued functions can convert one row of records into multiple rows or convert one column of records into multiple columns. Table-valued functions can only be used in JOIN LATERAL TABLE.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0206__table2519181442813" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Table-valued functions</caption><thead align="left"><tr id="dli_08_0206__row2051971410287"><th align="left" class="cellrowborder" valign="top" width="33%" id="mcps1.3.2.2.4.1.1"><p id="dli_08_0206__p6153183918287">Function</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="22%" id="mcps1.3.2.2.4.1.2"><p id="dli_08_0206__p17155339102819">Return Data Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="45%" id="mcps1.3.2.2.4.1.3"><p id="dli_08_0206__p1515615396285">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_0206__row125194143283"><td class="cellrowborder" valign="top" width="33%" headers="mcps1.3.2.2.4.1.1 "><p id="dli_08_0206__p19519114162816">split_cursor(value, delimiter)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22%" headers="mcps1.3.2.2.4.1.2 "><p id="dli_08_0206__p17519314182816">cursor</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.2.2.4.1.3 "><p id="dli_08_0206__p237225620283">Separates the "value" string into multiple rows of strings by using the delimiter.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="dli_08_0206__section111851752184413"><h4 class="sectiontitle">Example</h4><p id="dli_08_0206__p129101615154">Input one record ("student1", "student2, student3") and output two records ("student1", "student2") and ("student1", "student3").</p>
|
|
<pre class="screen" id="dli_08_0206__screen14480201913166">create source stream s1(attr1 string, attr2 string) with (......);
|
|
insert into s2 select attr1, b1 from s1 left join lateral table(split_cursor(attr2, ',')) as T(b1) on true;</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0086.html">Built-In Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|