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>
48 lines
5.0 KiB
HTML
48 lines
5.0 KiB
HTML
<a name="dli_spark_lengthb"></a><a name="dli_spark_lengthb"></a>
|
|
|
|
<h1 class="topictitle1">lengthb</h1>
|
|
<div id="body8662426"><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p1662914651016">This function is used to return the length of a specified string in bytes.</p>
|
|
<p id="dli_spark_lengthb__en-us_topic_0000001696338837_p12471148153910">Similar function: <a href="dli_spark_length.html#dli_spark_length">length</a>. The <strong id="dli_spark_lengthb__en-us_topic_0000001696338837_b6962150111211">length</strong> function is used to return the length of a string and return a value of the BIGINT type.</p>
|
|
<div class="section" id="dli_spark_lengthb__en-us_topic_0000001696338837_section45291954203217"><h4 class="sectiontitle">Syntax</h4><pre class="screen" id="dli_spark_lengthb__en-us_topic_0000001696338837_screen1164981619226">lengthb(string <str>)</pre>
|
|
</div>
|
|
<div class="section" id="dli_spark_lengthb__en-us_topic_0000001696338837_section992014913317"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_spark_lengthb__en-us_topic_0000001696338837_table1829154762513" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter</caption><thead align="left"><tr id="dli_spark_lengthb__en-us_topic_0000001696338837_row8830104792517"><th align="left" class="cellrowborder" valign="top" width="19.220000000000002%" id="mcps1.3.4.2.2.5.1.1"><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p983074711252">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="13.420000000000002%" id="mcps1.3.4.2.2.5.1.2"><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p6830124732517">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.590000000000002%" id="mcps1.3.4.2.2.5.1.3"><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p13318164512614">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="51.77%" id="mcps1.3.4.2.2.5.1.4"><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p08301547132513">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_spark_lengthb__en-us_topic_0000001696338837_row2826191220118"><td class="cellrowborder" valign="top" width="19.220000000000002%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p58771645125213">str</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="13.420000000000002%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p14826312111113">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.590000000000002%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p18826101211118">STRING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="51.77%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p026862711252">Input string</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_spark_lengthb__en-us_topic_0000001696338837_section210162513312"><h4 class="sectiontitle">Return Values</h4><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p889412281148">The return value is of the STRING type.</p>
|
|
<div class="note" id="dli_spark_lengthb__en-us_topic_0000001696338837_note1542519149539"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="dli_spark_lengthb__en-us_topic_0000001696338837_ul21323529163"><li id="dli_spark_lengthb__en-us_topic_0000001696338837_li11132752111618">If the value of <strong id="dli_spark_lengthb__en-us_topic_0000001696338837_b110915434743450">str</strong> is not of the STRING, BIGINT, DOUBLE, DECIMAL, or DATETIME type, an error is reported.</li><li id="dli_spark_lengthb__en-us_topic_0000001696338837_li1213215527162">If the value of <strong id="dli_spark_lengthb__en-us_topic_0000001696338837_b100654628343458">str</strong> is <strong id="dli_spark_lengthb__en-us_topic_0000001696338837_b194654382943458">NULL</strong>, <strong id="dli_spark_lengthb__en-us_topic_0000001696338837_b170079872043458">NULL</strong> is returned.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="dli_spark_lengthb__en-us_topic_0000001696338837_section13277192233920"><h4 class="sectiontitle">Example Code</h4><p id="dli_spark_lengthb__en-us_topic_0000001696338837_p6265174519819">The value <strong id="dli_spark_lengthb__en-us_topic_0000001696338837_b11783485525">5</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_lengthb__en-us_topic_0000001696338837_screen1755105211814">select lengthb('hello');</pre>
|
|
<p id="dli_spark_lengthb__en-us_topic_0000001696338837_p1626515455812">The value <strong id="dli_spark_lengthb__en-us_topic_0000001696338837_b19947141213527">NULL</strong> is returned.</p>
|
|
<pre class="screen" id="dli_spark_lengthb__en-us_topic_0000001696338837_screen1537952931012">select lengthb(null);</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0472.html">String Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|