forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Reviewed-by: Jiang, Beibei <beibei.jiang@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
896 lines
154 KiB
HTML
896 lines
154 KiB
HTML
<a name="EN-US_TOPIC_0000001234200693"></a><a name="EN-US_TOPIC_0000001234200693"></a>
|
|
|
|
|
|
<h1 class="topictitle1">Overview</h1>
|
|
|
|
<div id="body0000001107050738"><div class="section" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sb8b9c727c7804519a7f225392f374c42"><h4 class="sectiontitle">Basic Functions</h4><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_u8b35e18c1c40430eb9fe4b34cc08222f"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lf780e8fe203247ce89971e53c8e137bd"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b16589150145913">Connect to the database</strong>: Use the gsql client to remotely connect to the <span id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_text1750610314378">GaussDB(DWS)</span> database. <div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_note69247493366"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p592584973619">If the gsql client is used to connect to a database, the connection timeout period will be 5 minutes. If the database has not correctly set up a connection and authenticated the identity of the client within this period, gsql will time out and exit.</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p123892623813">To resolve this problem, see <a href="dws_gsql_008.html#EN-US_TOPIC_0000001188681032">Troubleshooting</a>.</p>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l5ea7fc2579c64ee4bb103b799c37ff1d"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b5390586710472">Run SQL statements</strong>: Interactively entered SQL statements and specified SQL statements in a file can be run.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l3e6fb0e1fa9f4d4b9fcc62cb19307453"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0059778819_ae2524c84d19b4bbb91371244b7926011">Run meta-commands</strong>: Meta-commands help the administrator view database object information, query cache information, format SQL output, and connect to a new database. For details about meta-commands, see <a href="dws_gsql_007.html#EN-US_TOPIC_0000001233922235">Meta-Command Reference</a>.</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sba7e2892fe454c69ac9c0fad3d1e4f62"><h4 class="sectiontitle">Advanced Features</h4><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a2cb533fc28bf4e9d825abd5b94cc9e68"><a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tafe4ef1072824d3c9d79cb8346c45e6c">Table 1</a> lists the advanced features of gsql.</p>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tafe4ef1072824d3c9d79cb8346c45e6c"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_tafe4ef1072824d3c9d79cb8346c45e6c"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tafe4ef1072824d3c9d79cb8346c45e6c" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Advanced features of gsql</caption><thead align="left"><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r97929cb64bfb4d54ace98337f22dc735"><th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.2.3.2.3.1.1"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aef34032c3f77443d9283b11ab198e45c">Feature</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="84%" id="mcps1.3.2.3.2.3.1.2"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aaa43ea85b9f1404692816e47dd63e729">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rca8859e9ba0c4ef5bdce6b9deea1ad84"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aa2b3fbcea9bb45e0ab778ddbe909df62">Variable</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ac1f2377d91654f51a2a2139d166c24e6">gsql provides a variable feature that is similar to the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706112628">shell</strong> command of Linux. The following <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706112853">\set</strong> meta-command of gsql can be used to set a variable:</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sdbf929f7ba16474e98cf631bde946396"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a70a7b1393ccd4f5da557acfe52a11be0">\set</strong> <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a2177493622b74ed1a49e1f99ab78acb3">varname value</em></pre>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ae26eddb4d6bf407bafeefc0b9ba2398a">To delete a variable, run the following command:</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sad754d271bd94e93b680343ee933ffc0"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a6752d22427d245fa88be5c5b006adb1c">\unset</strong> <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a53942bd1bf7b4915bff094cc7c56f51e">varname</em></pre>
|
|
<div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_n1f8cc3204b9f48c4a9ba7f97141a3bcb"><span class="notetitle"> NOTE: </span><div class="notebody"><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ue6e781fb76da4c018b25ebeb2efe2179"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l85e67e55698241fdb85bda8fd00dae0a">A variable is a key-value pair. The value length is determined by the special variable <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1168870194117">VAR_MAX_LENGTH</strong>. For details, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tb7d0ee8c8bbf4c2eb1f55dbe3ad2d5ee">Table 2</a>.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l6946751984264b889d38893f4a6ef492">Variable names must consist of case-sensitive letters (including non-Latin letters), digits, and underscores (_).</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l85a15cc3ce7941d8973a6c72f93e61b8">If the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706113455">\set</strong> <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i842352697113527">varname</em> meta-command (without the second parameter) is used, the variable is set without a value specified.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l127957c2990b4995b3f383d1f93723e6">If the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0085031667_b842352706114211">\set</strong> meta-command without parameters is used, values of all variables are displayed.</li></ul>
|
|
</div></div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a7838860f027e4d56bc6f32f18460e1b6">For details about variable examples and descriptions, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lc8477a0a74144ad1822fa622fe2f1136">Variable</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rf3fd75067595458e8c2dc007a64e22ed"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_af72bbe12d70f4f33ab10df0c2e11cf03">SQL substitution</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a5d48bc3cd2b240d9aad82fdd302f4999">Common SQL statements can be set to variables using the variable feature of gsql to simplify operations.</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a86a3cc52012447d5b019354cd0a7cbe7">For details about SQL substitution examples and descriptions, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l1817326f33bb4f84acfc1b7c840d1fed">SQL substitution</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r603a116915e04007a38808081202b594"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a728f0950efc542aa8a62113b2a24104b">Customized prompt</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a55a0812bcb9e4066b875b7d8297fd5a6">Prompts of gsql can be customized. Prompts can be modified by changing the reserved variables of gsql: <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i84235269710735">PROMPT1</em>, <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i84235269710740">PROMPT2</em>, and <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i84235269710744">PROMPT3</em>.</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_adce23373d2474ff781825e1cd8fcc913">These variables can be set to customized values or the values predefined by gsql. For details, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_laa92fb04b10c4ba18fd3cb8b192e5756">Prompt</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r02a190812c0f4c2889c9b81d2e0f7db4"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.3.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a395e168dbbb74ae5b5f9ba73929bd017">Client operation history record</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.3.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a83d47f8084cf49289e7e651fd90c8a0e">gsql records client operation history. This function is enabled by specifying the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1864167142815">-r</strong> parameter when a client is connected. The number of historical records can be set using the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b786487142819">\set</strong> command. For example, <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706114854">\set HISTSIZE 50</strong> indicates that the number of historical records is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706114917">50</strong>. <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706114924">\set HISTSIZE 0</strong> indicates that the operation history is not recorded.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_n5bed57e5fb944360bfdca3a95435396a"><span class="notetitle"> NOTE: </span><div class="notebody"><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ufd027774bae24cf2b92d08606d23241a"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l35c0785757bb4c90b5d8919ceb5d142a">The default number of historical records is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706101057">32</strong>. The maximum number of historical records is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706102511">500</strong>. If interactively entered SQL statements contain Chinese characters, only the UTF-8 encoding environment is supported.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l9306715c8e3b4f96827e5a2fccc01b83">For security reasons, the records containing sensitive words, such as <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270610178">PASSWORD</strong> and <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706101714">IDENTIFIED</strong>, are regarded sensitive and not recorded in historical information. This indicates that you cannot view these records in command output histories.</li></ul>
|
|
</div></div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ubb78e22c20b24fe884006b965a4ef155"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lc8477a0a74144ad1822fa622fe2f1136"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lc8477a0a74144ad1822fa622fe2f1136"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_lc8477a0a74144ad1822fa622fe2f1136"></a>Variable<div class="p" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a08a4dcd45f854b0ab69cf7f4bd9b0970"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lc8477a0a74144ad1822fa622fe2f1136"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_lc8477a0a74144ad1822fa622fe2f1136"></a>To set a variable, run the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706115257">\set</strong> meta-command of gsql. For example, to set variable <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i842352697115424">foo</em> to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270611548">bar</strong>, run the following command:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s9fc96dc3ca6046fd89f8e7f65f28eeb5"><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="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="n">bar</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="p" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a1808d5a4ffbb47be8e148f52aabab38a">To quote the value of a variable, add a colon (:) before the variable. For example, to view the value of variable <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i842352697115510">foo</em>, run the following command:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s2a5e3b642f1744bcb95e055a56cce953"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="n">echo</span><span class="w"> </span><span class="p">:</span><span class="n">foo</span>
|
|
<span class="n">bar</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a99ab6dcc3d704be396ac82cdc91ecb24">This variable quotation method is suitable for regular SQL statements and meta-commands.</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p153351357191415">When the CLI parameter <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b853217519">--dynamic-param</strong> (for details, see <a href="dws_gsql_006.html#EN-US_TOPIC_0000001233922173__en-us_topic_0000001233922179_en-us_topic_0000001145410531_td295af60028d45cc9362b2f0f81eba40">Table 1</a>) is used or the special variable <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b5610217518">DYNAMIC_PARAM_ENABLE</strong> (for details, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tb7d0ee8c8bbf4c2eb1f55dbe3ad2d5ee">Table 2</a>) is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b870215520">true</strong>, you can execute the SQL statement to set the variable. The variable name is the column name in the SQL execution result and can be referenced using <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1318311018552">${}</strong>. For example:</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_screen715222032017"><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>
|
|
<span class="normal">6</span>
|
|
<span class="normal">7</span>
|
|
<span class="normal">8</span>
|
|
<span class="normal">9</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">DYNAMIC_PARAM_ENABLE</span><span class="w"> </span><span class="k">true</span>
|
|
<span class="k">SELECT</span><span class="w"> </span><span class="s1">'Jack'</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="ss">"Name"</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">Name</span>
|
|
<span class="c1">------</span>
|
|
<span class="w"> </span><span class="n">Jack</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
|
|
<span class="err">\</span><span class="n">echo</span><span class="w"> </span><span class="err">${</span><span class="n">Name</span><span class="err">}</span>
|
|
<span class="n">Jack</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p169919510233">In the preceding example, the SELECT statement is used to set the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b5775143816554">Name</strong> variable, and the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b452719524559">${}</strong> referencing method is used to obtain the value of the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b696811411563">Name</strong> variable. In this example, the special variable <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b453713435717">DYNAMIC_PARAM_ENABLE</strong> controls this function. You can also use the CLI parameter <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1375164685712">--dynamic-param</strong> to control this function, for example, <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b39241385817">gsql -d postgres -p 25308 --dynamic-param -r</strong>.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_note872442015304"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ul07241020163013"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li14724132023017">Do not set variables when the SQL statement execution fails.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li3435185603012">If the SQL statement execution result is empty, set the column name as a variable and assign it with an empty string.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li17201653123116">If the SQL statement execution result is a record, set the column name as a variable and assign it with the corresponding string.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li147543316326">If the SQL statement execution result contains multiple records, set the column name as a variable concatenated by specific characters, and then assign the value to the variable. The special variable <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b56580402074">RESULT_DELIMITER</strong> (for details, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tb7d0ee8c8bbf4c2eb1f55dbe3ad2d5ee">Table 2</a>) determines the specific character. The default delimiter is a comma (,).</li></ul>
|
|
</div></div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p10548221113715">Examples of setting variables by executing SQL statements:</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_screen1268620482025"><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>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span>
|
|
<span class="normal">11</span>
|
|
<span class="normal">12</span>
|
|
<span class="normal">13</span>
|
|
<span class="normal">14</span>
|
|
<span class="normal">15</span>
|
|
<span class="normal">16</span>
|
|
<span class="normal">17</span>
|
|
<span class="normal">18</span>
|
|
<span class="normal">19</span>
|
|
<span class="normal">20</span>
|
|
<span class="normal">21</span>
|
|
<span class="normal">22</span>
|
|
<span class="normal">23</span>
|
|
<span class="normal">24</span>
|
|
<span class="normal">25</span>
|
|
<span class="normal">26</span>
|
|
<span class="normal">27</span>
|
|
<span class="normal">28</span>
|
|
<span class="normal">29</span>
|
|
<span class="normal">30</span>
|
|
<span class="normal">31</span>
|
|
<span class="normal">32</span>
|
|
<span class="normal">33</span>
|
|
<span class="normal">34</span>
|
|
<span class="normal">35</span>
|
|
<span class="normal">36</span>
|
|
<span class="normal">37</span>
|
|
<span class="normal">38</span>
|
|
<span class="normal">39</span>
|
|
<span class="normal">40</span>
|
|
<span class="normal">41</span>
|
|
<span class="normal">42</span>
|
|
<span class="normal">43</span>
|
|
<span class="normal">44</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">DYNAMIC_PARAM_ENABLE</span><span class="w"> </span><span class="k">true</span>
|
|
<span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">student</span><span class="w"> </span><span class="p">(</span><span class="n">id</span><span class="w"> </span><span class="nb">INT</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">32</span><span class="p">))</span><span class="w"> </span><span class="n">DISTRIBUTE</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">HASH</span><span class="p">(</span><span class="n">id</span><span class="p">);</span>
|
|
<span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span>
|
|
<span class="k">INSERT</span><span class="w"> </span><span class="k">INTO</span><span class="w"> </span><span class="n">student</span><span class="w"> </span><span class="k">VALUES</span><span class="w"> </span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'Jack'</span><span class="p">),</span><span class="w"> </span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="s1">'Tom'</span><span class="p">),</span><span class="w"> </span><span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="s1">'Jerry'</span><span class="p">);</span>
|
|
<span class="k">INSERT</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="mi">3</span>
|
|
<span class="c1">-- Do not set variables when the SQL statement execution fails.</span>
|
|
<span class="k">SELECT</span><span class="w"> </span><span class="n">id</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">student</span><span class="w"> </span><span class="k">ORDER</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">idi</span><span class="p">;</span>
|
|
<span class="n">ERROR</span><span class="p">:</span><span class="w"> </span><span class="k">column</span><span class="w"> </span><span class="ss">"idi"</span><span class="w"> </span><span class="n">does</span><span class="w"> </span><span class="k">not</span><span class="w"> </span><span class="n">exist</span>
|
|
<span class="n">LINE</span><span class="w"> </span><span class="mi">1</span><span class="p">:</span><span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="n">id</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">student</span><span class="w"> </span><span class="k">ORDER</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">idi</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="o">^</span>
|
|
<span class="err">\</span><span class="n">echo</span><span class="w"> </span><span class="err">${</span><span class="n">id</span><span class="err">}</span><span class="w"> </span><span class="err">${</span><span class="n">name</span><span class="err">}</span>
|
|
<span class="err">${</span><span class="n">id</span><span class="err">}</span><span class="w"> </span><span class="err">${</span><span class="n">name</span><span class="err">}</span>
|
|
|
|
<span class="c1">-- If the execution result contains multiple records, use specific characters to concatenate the values.</span>
|
|
<span class="k">SELECT</span><span class="w"> </span><span class="n">id</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">student</span><span class="w"> </span><span class="k">ORDER</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">id</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">name</span>
|
|
<span class="c1">----+-------</span>
|
|
<span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Jack</span>
|
|
<span class="w"> </span><span class="mi">2</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Tom</span>
|
|
<span class="w"> </span><span class="mi">3</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Jerry</span>
|
|
<span class="p">(</span><span class="mi">3</span><span class="w"> </span><span class="k">rows</span><span class="p">)</span>
|
|
|
|
<span class="err">\</span><span class="n">echo</span><span class="w"> </span><span class="err">${</span><span class="n">id</span><span class="err">}</span><span class="w"> </span><span class="err">${</span><span class="n">name</span><span class="err">}</span>
|
|
<span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="w"> </span><span class="n">Jack</span><span class="p">,</span><span class="n">Tom</span><span class="p">,</span><span class="n">Jerry</span>
|
|
|
|
<span class="c1">-- If the execution result contains only one record, execute the following statement to set the variable:</span>
|
|
<span class="k">SELECT</span><span class="w"> </span><span class="n">id</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">student</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">name</span>
|
|
<span class="c1">----+------</span>
|
|
<span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Jack</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
|
|
<span class="err">\</span><span class="n">echo</span><span class="w"> </span><span class="err">${</span><span class="n">id</span><span class="err">}</span><span class="w"> </span><span class="err">${</span><span class="n">name</span><span class="err">}</span>
|
|
<span class="mi">1</span><span class="w"> </span><span class="n">Jack</span>
|
|
|
|
<span class="c1">-- If the execution result is empty, assign the variable with an empty string as follows:</span>
|
|
<span class="k">SELECT</span><span class="w"> </span><span class="n">id</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">student</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">4</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">name</span>
|
|
<span class="c1">----+------</span>
|
|
<span class="p">(</span><span class="mi">0</span><span class="w"> </span><span class="k">rows</span><span class="p">)</span>
|
|
|
|
<span class="err">\</span><span class="n">echo</span><span class="w"> </span><span class="err">${</span><span class="n">id</span><span class="err">}</span><span class="w"> </span><span class="err">${</span><span class="n">name</span><span class="err">}</span>
|
|
|
|
<span class="w"> </span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ab4c1bc90f6834ddb81947438cc31e69e">gsql pre-defines some special variables and plans the values of these variables. To ensure compatibility with later versions, do not use these variables for other purposes. For details about all special variables, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tb7d0ee8c8bbf4c2eb1f55dbe3ad2d5ee">Table 2</a>.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_n5a4351ec06de405b90e12bd5606f195b"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_u21c5795d1a5a46a1a81e229c1945f9ff"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lf6455d523c0c42a79930efe94a26cf41">All the special variables consist of uppercase letters, digits, and underscores (_).</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l43cb2518b39e4e10b96758666b154461">To view the default value of a special variable, run the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1707374115819">\echo :</strong><em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i651794604115819">varname</em> meta-command, for example, <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706103027">\echo :</strong><em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i842352697103030">DBNAME</em>.</li></ul>
|
|
</div></div>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tb7d0ee8c8bbf4c2eb1f55dbe3ad2d5ee"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_tb7d0ee8c8bbf4c2eb1f55dbe3ad2d5ee"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tb7d0ee8c8bbf4c2eb1f55dbe3ad2d5ee" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Setting special variables</caption><thead align="left"><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_re4028f1bbfd94d4b8624a2768b77589f"><th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.2.4.1.12.2.4.1.1"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ae5ea08a38ba34cce9c24a9e987cf1707">Variable</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="28.000000000000004%" id="mcps1.3.2.4.1.12.2.4.1.2"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a7d47f01044854019822b41d25cbdca13">Setting Method</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="56.99999999999999%" id="mcps1.3.2.4.1.12.2.4.1.3"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a2f19f87c304b4814999985e0baefb056">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rbf7b83fef40a41d38db9881fb7ae46e5"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a1ddc95fe41064e1687036ca51267f805">DBNAME</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s47218545a84347778ab24ffe1a92907b">\set DBNAME <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a67c007986dc5469db502a68769c0902e">dbname</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a4f33df10fb6444f68c29cb0ca673853e">Specifies the name of a connected database. This variable is set again when a database is connected.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r76738eede8df4aa48e64e2f875100659"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aca6c2477575f4ab1b0c6d0ae2a2853e3">ECHO</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sc898689ac67a42059171e3fdf0dd546f">\set ECHO all | queries</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_u42ba3c3d2d8445e4bbbb05e354440b22"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l5d75ef3a3b1d4547820df6505c8ab55b">If this variable is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b16902073289">all</strong>, only the query information is displayed. This has the same effect as specifying the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0058968129_b842352706135744">-a</strong> parameter when gsql is used to connect to a database.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l2c1803b958374c3bb5dc77e3a2787e7f">If this variable is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b590311720286">queries</strong>, the command line and query information are displayed. This has the same effect as specifying the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706135840">-e</strong> parameter when gsql is used to connect to a database.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r1297071b365c4adba0ceffe6dc5f12af"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ab12d0c1aa80d442591499c1a408d65a3">ECHO_HIDDEN</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s8bfbd601fd834105af097277e4ef29ba">\set ECHO_HIDDEN on | off | noexec</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a08b1e7c5936147cf90510e877111f24e">When a meta-command (such as <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b763208815105446">\dg</strong>) is used to query database information, the value of this variable determines the query behavior.</p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_u1de63b64df80444aa6c598994d8dbe29"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l92cc9ac8a07b42bb849c5ae9b9309247">If this variable is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b19040722813">on</strong>, the query statements that are called by the meta-command are displayed, and then the query result is displayed. This has the same effect as specifying the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270614053">-E</strong> parameter when gsql is used to connect to a database.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l510bc83064db4185918239e22a910e28">If this variable is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b390412732813">off</strong>, only the query result is displayed.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l63a07e2fdea94de5bbeb8308f5fdd8b8">If this variable is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b145963337315">noexec</strong>, only the query information is displayed, and the query is not run.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rc7b168bce4314bd59bee7fb04555e69c"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a547310ee56404cc5864e37dc114aa971">ENCODING</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_se2ca7af8dec245c7ab4bf2bc36bef658">\set ENCODING <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aaf0c47ee30184eefb69b4a86cdb4c0b0">encoding</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a27e9c5c55e7c445283a48db02403fc92">Specifies the character set encoding of the current client.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r03160c1c4d18432c8dbd79f1d8136cc0"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a736b159d43cd439ab11ffdb7eb202c80">FETCH_COUNT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sa0435210dcf942749cf3017ecb048443">\set FETCH_COUNT <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_adc5bc7f876ff4a81aa35eacffb2f213a">variable</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_u15c16568ae404efd87c1025c98c5ddde"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l320f500a491c4c7c8dc75105ccde5dd8">If the value is an integer greater than <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706103642">0</strong>, for example, <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i84235269714759">n</em>, <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i17312561811487">n</em> lines will be selected from the result set to the cache and displayed on the screen when the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270614940">SELECT</strong> statement is run.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_le36773801a3d41dda0ae081cdd168ce2">If this variable is not set or set to a value less than or equal to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706103715">0</strong>, all results are selected at a time to the cache when the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706141032">SELECT</strong> statement is run.</li></ul>
|
|
<div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_n007f19227b074501812f123239cd9efd"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a1b80d82985aa4053b727e6fc1fe1ce25">Setting this variable to a proper value reduces memory usage. Generally, values from 100 to 1000 are proper.</p>
|
|
</div></div>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rd7763803596c4edd88c2d6a7f9bff795"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a1409401c71b54f38bb67cf1e229fe248">HISTCONTROL</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s257c60b000de4295855f82b8a5cf5f78">\set HISTCONTROL ignorespace | ignoredups | ignoreboth | none</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_uc5758d079bc448e090df74e4dbd0c313"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lb09c7957e56f414d8a736d9e89199df6"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706144036">ignorespace</strong>: A line started with a space is not written to the historical record.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l35e6e684fbc842b0be7d684d221587eb"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706144044">ignoredups</strong>: A line that exists in the historical record is not written to the historical record. </li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ld7035751516e47528010c23b2b8209c8"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706144050">ignoreboth</strong>, <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270614411">none</strong>, or other values: All the lines read in interaction mode are saved in the historical record.<div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_nef23a4f0c2f5408783250028677fac65"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aa9cf3abb56fe4abf89b5c3ebcee20c88"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706144242">none</strong> indicates that <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270614431">HISTCONTROL</strong> is not set.</p>
|
|
</div></div>
|
|
</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r415723b9dd4142d4944646a229671e24"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a61872aaf7e684501873ef2f51a3e8b94">HISTFILE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s0264334942b1428baff24cf18d2c0804">\set HISTFILE <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a1cf5ff3b7a414ecb99025366f49ba3dd">filename</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a62860d990eb04bdf8b216db594710aec">Specifies the file for storing historical records. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b991215782816">~/.bash_history</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r1d9e86ea2c294a99bfdb3f2de56d696e"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a75d7fba831274707aa93dd092361585a">HISTSIZE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s0c9cc768d94e49b2bcbb947b86416f1d">\set HISTSIZE <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a45c104a406134ad5b1d54ce1d939f841">size</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aeced317f5b4545e3b8e4d54ad737120a">Specifies the number of commands in the history command. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b169131773281">500</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rfcd3fd2737d840a087582af559e1f163"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a5d0289fe6599484d895f959356623a74">HOST</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s6eb449dda2414b32a26c4ec18fee7124">\set HOST <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a7cd7aa361bc842009037c4a678cd1f11">hostname</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a40a2bf8b492044f199136e5ebf1d2201">Specifies the name of a connected host.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r2f00efa873e34612881361901a5905bd"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ae2748c3d16bc484da527b4a0f9459605">IGNOREEOF</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sff946872273644e984ca56ef4b4ab794">\set IGNOREEOF <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a741f461bdd614629857b65a929d5f376">variable</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_u8ae46c0518734f3bac7a4de2076f6312"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l53d3da6d21204dae932863e1a0bb39be">If this variable is set to a number, for example, <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706104132">10</strong>, the first nine EOF characters (generally <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b99831997615853">Ctrl</strong>+<strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b207992431315853">C</strong>) entered in gsql are neglected and the gsql program exits when the tenth <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270615833">Ctrl</strong>+<strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270615839">C</strong> is entered.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l98c159cc84724cc392a7f83f66e2e520">If this variable is set to a non-numeric value, the default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b6916187162813">10</strong>.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l9c54a0aa03974d769d6dd14cee182d02">If this variable is deleted, gsql exits when an EOF is entered.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r9865d60980ba4a45b78fdd7342cbe7f1"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aa0e89a6745bc41eca14c89b5c1dbd92e">LASTOID</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_saa1bb75af9344a2d9da308be0b7d9809">\set LASTOID <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a796e753893164957864586925cb0b84d">oid</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a9550014f31294a869b23ec33c43a68c4">Specifies the last OID, which is the value returned by an <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706152817">INSERT</strong> or <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706152822">lo_import</strong> command. This variable is valid only before the output of the next SQL statement is displayed.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r8eb34873344a4bffbc760111517c8827"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a76068d2fd1c248538c270b049e0fe158">ON_ERROR_ROLLBACK</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sa4cc66d14e71441f92810977eda8e9e1">\set ON_ERROR_ROLLBACK on | interactive | off</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_u3340536cf842477da1c77db7cf786dcf"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lbdaf33645d3944c5849bbd16c2402b73">If the value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1091811782816">on</strong>, an error that may occur in a statement in a transaction block is ignored and the transaction continues.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l01847d0cbf8749f198f55d6e9623f50d">If the value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b129192716282">interactive</strong>, the error is ignored only in an interactive session.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l1414770c642e430f9479518dcfc1cdca">If the value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706153729">off</strong> (the default value), the error triggers the rollback of the transaction block. In <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706153843">on_error_rollback-on</strong> mode, a <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706153850">SAVEPOINT</strong> is set before each statement of a transaction block, and an error triggers the rollback of the transaction block.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r75e6025a8ddd4c30b1696967ad7c1fab"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a0a47ff8c3ce34b21a293e322451734f4">ON_ERROR_STOP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_scb9440a7b1154d249779702ec509c1b9">\set ON_ERROR_STOP on | off</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_udb93de751d0f4855b9e2b9be243a372a"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lb49bd2624dcc4397afece070ad79841e"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706154230">on</strong>: specifies that the execution stops if an error occurs. In interactive mode, gsql returns the output of executed commands immediately.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l19f13a6d21bb4bb198aad83efa1bdaa4"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706154233">off</strong> (default value): specifies that an error, if occurring during the execution, is ignored, and the execution continues.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r69333989458d4a779492287fc47bd56d"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a92f549f2c4e7471fab96f77076afa862">PORT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s63e8aa8b2d494fd7bafc6fc9fb5b195b">\set PORT <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_adaa50a352f734efba291786fb80cd7cb">port</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aecfd4d57dd39415ba67d859d2485c8cf">Specifies the port number of a connected database.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r1da1a79f6f22411eba25a85b83b5ab9c"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a7151b856b4b34da7a52350a3343b9b94">USER</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s3c31b5243ad341fa80ce5cd981f49715">\set USER <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aa695c933886d4201922a59c355844994">username</em></pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a44b4c883d0e64e638924a14c1d76fcaf">Specifies the connected database user.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r45079d91dabd447b8fbe63ddf6f6b187"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a688493b178f2456f8dc63f1b796c7529">VERBOSITY</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s1998d56069424f039bd26bbc3372cc0b">\set VERBOSITY terse | default | verbose</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_acf15b9d036a54986a0338c44689a0916">This variable can be set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b79248717287">terse</strong>, <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b29241779285">default</strong>, or <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b89241377283">verbose</strong> to control redundant lines of error reports.</p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ud9f8d5e03ce1413c9c2baf4d48efc862"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_la7fc20ffeb1c4bce8b5b8e17acd56f94"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0058968129_b842352706155015">terse</strong>: Only critical and major error texts and text locations are returned (which is suitable for single-line error information).</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l1e053ec20d0c42cfa69a1454171dc495"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1592447122820">default</strong>: Critical and major error texts and text locations, error details, and error messages (possibly involving multiple lines) are all returned.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l8e1e195bb3664211b18d45ae1b643989"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b2925127132815">verbose</strong>: All error information is returned.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row841204113517"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p1428412511">VAR_NOT_FOUND</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p10424416512">\set VAR_NOT_FOUND default | null | error</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p10423411952">You can set this parameter to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b11137165210256">default</strong>, <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1291655319254">null</strong>, or <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1351615692512">error</strong> to control the processing mode when the referenced variable does not exist.</p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ul171671346161010"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li91674466102"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b132501762619">default</strong>: Do not replace the variable and retain the original character string.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li4167194611019"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1010951742616">null</strong>: Replace the original character string with an empty character string.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li4167144618102"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b148818259265">error</strong>: Output error information and retain the original character string.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row20352048191215"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p83684818129">VAR_MAX_LENGTH</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p83634814125">\set VAR_MAX_LENGTH<em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i512102131315"> variable</em></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p036748131211">Specifies the variable value length. The default value is 4096. If the length of a variable value exceeds the specified parameter value, the variable value is truncated and an alarm is generated.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row636318329107"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p536453261019">ERROR_LEVEL</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p2364143210103">\set ERROR_LEVEL transaction | statement</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p1336493210101">Indicates whether a transaction or statement is successful or not. Value options: <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b19230135251411">transaction</strong> or <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b3781155616145">statement</strong>. Default value: <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b567971021511">transaction</strong></p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ul199841012181110"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li5984101241114"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1535718221151">statement</strong>: ERROR records whether the previous SQL statement is executed successfully.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li19984912121112"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1298153120155">transaction</strong>: ERROR records whether the previous SQL statement is successfully executed or whether an error occurs during the execution of the previous transaction.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row342484291716"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p19425164210171">ERROR</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p1842544241717">\set ERROR true | false</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p2042514291719">Indicates whether the previous SQL statement is successfully executed or whether an error occurs during the execution of the previous transaction. <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1714354015164">false</strong>: succeeded. <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b73365918164">true</strong>: failed. default value: <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1091010106179">false</strong> The setting can be updated by executing SQL statements. You are not advised to manually set this parameter.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row15215193914235"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p6216339152318">LAST_ERROR_SQLSTATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p1621693911234">\set LAST_ERROR_SQLSTATE state</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p1921643916238">Error code of the previously failed SQL statement execution. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b22071943153417">00000</strong>. The setting can be updated by executing SQL statements. You are not advised to manually set this parameter.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row7261141271"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p142613413272">LAST_ERROR_MESSAGE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p13269432719">\set LAST_ERROR_MESSAGE message</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p2262047279">Error message of the previously failed SQL statement execution. The default value is an empty string. The setting can be updated by executing SQL statements. You are not advised to manually set this parameter.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row4323728192813"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p33234285287">ROW_COUNT</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p8323182852810">\set ROW_COUNT count</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ul1023814292495"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li172381129194917">If ERROR_LEVEL is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1916771564918">statement</strong>, this parameter indicates the number of rows returned after the previous SQL statement is executed or the number of affected rows.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li36505519526">If ERROR_LEVEL is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b39904361521">transaction</strong> and an internal error occurs when a transaction ends, this parameter indicates the number of rows returned by the last SQL statement of the transaction or the number of affected rows. Otherwise, this parameter indicates the number of rows returned by the last SQL statement or the number of affected rows.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p63237285286">If the SQL statement fails to be executed, set this parameter to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b3926154025411">0</strong>. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b2863204435411">0</strong>. The setting can be updated by executing SQL statements. You are not advised to manually set this parameter.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row1749610137316"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p174971134312">SQLSTATE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p14497141314313">\set SQLSTATE state</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ul176823186412"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li146821181417">If ERROR_LEVEL is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b139751252165417">statement</strong>, this parameter indicates the status code of the previous SQL statement.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li6682118124113">If ERROR_LEVEL is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1796715146557">transaction</strong> and an internal error occurs when a transaction ends, this parameter indicates the status code of the last SQL statement in the transaction. Otherwise, this parameter indicates the status code of the previous SQL statement.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p17300448498">The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b57977422064">00000</strong>. The setting can be updated by executing SQL statements. You are not advised to manually set this parameter.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row1147592818333"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p8475152883319">LAST_SYS_CODE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p5475428103315">\set LAST_SYS_CODE code</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p14475192817334">Returned value of the previous system command execution. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b883410185111">0</strong>. The setting can be updated by using the meta-command <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b8986192695216">\!</strong> to run the system command. You are not advised to manually set this parameter.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row183373517342"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p113383515344">DYNAMIC_PARAM_ENABLE</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p53453593413">\set DYNAMIC_PARAM_ENABLE true | false</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p15344355349">Controls the generation of variables and the variable referencing method <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1687411018562">${}</strong> during SQL statement execution. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b66961820125611">false</strong>.</p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ul29181548143515"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li09181348103516"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b13522326175612">true</strong>: Generate variables when executing SQL statements, and support the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b17524185916181">${}</strong> variable referencing method.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_li189181483351"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b452911547215">false</strong>: Do not generate variables when executing SQL statements, and the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b20258123913223">${}</strong> variable referencing method is not supported either.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_row12590402717"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p1339216490588">CONVERT_QUOTE_IN_DYNAMIC_PARAM</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p8365165716584">\set CONVERT_QUOTE_IN_DYNAMIC_PARAM true | false</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p155711765919">Specifies whether to escape single quotation marks, double quotation marks, and backslashes during dynamic variable parsing. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b43891019311">true</strong>.</p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_ul203920117112"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li7392101216"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b250419061712">true</strong>: Indicates that during dynamic variable parsing, single quotation marks, double quotation marks, and backslashes (\) need to be escaped, and SQL substitution automatically escapes quotation marks and backslashes in variables.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li171793712115"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b1998939111814">false</strong>: Indicates that during dynamic variable parsing single quotation marks, double quotation marks, and backslashes (\) do not need to be escaped. SQL substitution does not process strings in variables. You need to manually escape them as needed.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p16557473597">For details about the usage example, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li148738487919">CONVERT_QUOTE_IN_DYNAMIC...</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_row1311673711384"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p2116163783815">RESULT_DELIMITER</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p4116183710383">\set RESULT_DELIMITER delimiter</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p11161337173812">Controls the delimiter used for concatenating multiple records when variables are generated during SQL statement execution. The default delimiter is comma (,).</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_row15333121725616"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p265973811543">COMPARE_STRATEGY</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p465903818546">\set COMPARE_STRATEGY default | natural | equal</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p9659438105411">Used to specify the value comparison policy of the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b3577191912484">\if</strong> expression. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b19577161904817">default</strong>.</p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_ul144214436593"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li184220436599"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b1355265118486">default</strong>: Specifies the default comparison policy. Only strings or numbers can be compared, and strings cannot be compared with numbers. Parameters inside single quotation marks (') are identified as strings, and parameters outside single quotation marks (') are identified as numbers.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li16421943145916"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b12560615174912">natural</strong>: The default comparison policy is supported, and parameters that contain dynamic variables are identified as strings. When one side of the comparison operator is a number, try to convert the other side to a number, and then compare the numbers on both sides. If the conversion fails, an error is reported and the comparison result is false.</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li416916291071"><strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b109236533490">equal</strong>: Only the equality comparison is supported. The comparison is performed based on strings.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p15848105917814">For details, see <a href="dws_gsql_007.html#EN-US_TOPIC_0000001233922235__en-us_topic_0000001234200619_li928310446513">\if conditional block comparison rules and examples</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_row84372249561"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.4.1.12.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p09452129111">COMMAND_ERROR_STOP</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.2.4.1.12.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p14945201215114">\set COMMAND_ERROR_STOP on | off</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.2.4.1.12.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p16945151213112">Determines whether to report the error and stop executing the meta-command when an error occurs during meta-command execution. By default, the meta-command execution is not stopped.</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p736693417104">For details, see the <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li12508192661216">example of using COMMAND_ERROR_STOP</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ul344395133415"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l3b3d287dcf71454bb689dd8175444f20">The following is an example of using the special variables ERROR_LEVEL and ERROR:</li></ul>
|
|
<div class="p" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p13496145213011">When ERROR_LEVEL is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b127692119567">statement</strong>, ERROR records whether the previous SQL statement is executed successfully. In the following example, when an SQL execution error occurs in a transaction and the transaction ends, the value of ERROR is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b17228534165713">false</strong>. In this case, ERROR only records whether the previous SQL statement ends successfully.<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_screen14320842155910"><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>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span>
|
|
<span class="normal">11</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">ERROR_LEVEL</span><span class="w"> </span><span class="k">statement</span>
|
|
<span class="k">begin</span><span class="p">;</span>
|
|
<span class="k">BEGIN</span>
|
|
<span class="k">select</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">;</span>
|
|
<span class="n">ERROR</span><span class="p">:</span><span class="w"> </span><span class="n">syntax</span><span class="w"> </span><span class="n">error</span><span class="w"> </span><span class="k">at</span><span class="w"> </span><span class="k">or</span><span class="w"> </span><span class="n">near</span><span class="w"> </span><span class="ss">";"</span>
|
|
<span class="n">LINE</span><span class="w"> </span><span class="mi">1</span><span class="p">:</span><span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">;</span>
|
|
<span class="w"> </span><span class="o">^</span>
|
|
<span class="k">end</span><span class="p">;</span>
|
|
<span class="k">ROLLBACK</span>
|
|
<span class="err">\</span><span class="n">echo</span><span class="w"> </span><span class="p">:</span><span class="n">ERROR</span>
|
|
<span class="k">false</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_p1232134215919">When ERROR_LEVEL is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1347404785815">transaction</strong>, ERROR can be used to capture SQL execution errors in a transaction. In the following example, when an SQL execution error occurs in a transaction and the transaction ends, the value of ERROR is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b88801251105820">true</strong>.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_screen104461745910"><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>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span>
|
|
<span class="normal">11</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">ERROR_LEVEL</span><span class="w"> </span><span class="k">transaction</span>
|
|
<span class="k">begin</span><span class="p">;</span>
|
|
<span class="k">BEGIN</span>
|
|
<span class="k">select</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">;</span>
|
|
<span class="n">ERROR</span><span class="p">:</span><span class="w"> </span><span class="n">syntax</span><span class="w"> </span><span class="n">error</span><span class="w"> </span><span class="k">at</span><span class="w"> </span><span class="k">or</span><span class="w"> </span><span class="n">near</span><span class="w"> </span><span class="ss">";"</span>
|
|
<span class="n">LINE</span><span class="w"> </span><span class="mi">1</span><span class="p">:</span><span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="p">;</span>
|
|
<span class="w"> </span><span class="o">^</span>
|
|
<span class="k">end</span><span class="p">;</span>
|
|
<span class="k">ROLLBACK</span>
|
|
<span class="err">\</span><span class="n">echo</span><span class="w"> </span><span class="p">:</span><span class="n">ERROR</span>
|
|
<span class="k">true</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_ul1450842617123"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li12508192661216"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li12508192661216"></a><a name="en-us_topic_0000001233922133_li12508192661216"></a>The following is an example of using the special variable <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b0604736205116">COMMAND_ERROR_STOP</strong>:</li></ul>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p17628154914138">When <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b1163712413523">COMMAND_ERROR_STOP</strong> is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b1637824135211">on</strong> and an error occurs during the meta-command execution, the error is reported and the meta-command execution is stopped. When this function is enabled, the execution error of the meta-command can be effectively detected.</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p195081264122">When <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b72401598539">COMMAND_ERROR_STOP</strong> is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b824179105314">off</strong> and an error occurs during the meta-command execution, related information is printed and the script continues to be executed.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_screen149519018401"><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></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">COMMAND_ERROR_STOP</span><span class="w"> </span><span class="k">on</span>
|
|
<span class="err">\</span><span class="n">i</span><span class="w"> </span><span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">omm</span><span class="o">/</span><span class="n">copy_data</span><span class="p">.</span><span class="k">sql</span>
|
|
|
|
<span class="k">select</span><span class="w"> </span><span class="n">id</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="n">student</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p98573333146">When <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b1120143895313">COMMAND_ERROR_STOP</strong> in the preceding script is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b3126133845314">on</strong>, an error message is displayed after the error is reported, and the script execution is stopped.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_screen1476513610417"><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="n">gsql</span><span class="p">:</span><span class="n">test</span><span class="p">.</span><span class="k">sql</span><span class="p">:</span><span class="mi">2</span><span class="p">:</span><span class="w"> </span><span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">omm</span><span class="o">/</span><span class="n">copy_data</span><span class="p">.</span><span class="k">sql</span><span class="p">:</span><span class="w"> </span><span class="k">Not</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">directory</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p1165874291415">When <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b1222284075411">COMMAND_ERROR_STOP</strong> is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b1422954017546">off</strong>, an error message is displayed after the error is reported, and the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b10230140135411">SELECT</strong> statement continues to be executed.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_screen145914224113"><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="n">gsql</span><span class="p">:</span><span class="n">test</span><span class="p">.</span><span class="k">sql</span><span class="p">:</span><span class="mi">2</span><span class="p">:</span><span class="w"> </span><span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">omm</span><span class="o">/</span><span class="n">copy_data</span><span class="p">.</span><span class="k">sql</span><span class="p">:</span><span class="w"> </span><span class="k">Not</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">directory</span>
|
|
<span class="w"> </span><span class="n">id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">name</span>
|
|
<span class="c1">----+------</span>
|
|
<span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Jack</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>
|
|
</li></ul>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ue677df2ff7a14b60b5f7a6e2954e024c"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l1817326f33bb4f84acfc1b7c840d1fed"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l1817326f33bb4f84acfc1b7c840d1fed"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_l1817326f33bb4f84acfc1b7c840d1fed"></a>SQL substitution<div class="p" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a88303d218ecc426a8638335cdc4b9077"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l1817326f33bb4f84acfc1b7c840d1fed"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_l1817326f33bb4f84acfc1b7c840d1fed"></a>gsql, like a parameter of a meta-command, provides a key feature that enables you to substitute a standard SQL statement for a gsql variable. gsql also provides a new alias or identifier for the variable. To replace the value of a variable using the SQL substitution method, add a colon (:) in front of the variable. For example:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sdf41df09dc324d9cb8eb499e3fe64764"><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>
|
|
<span class="normal">6</span>
|
|
<span class="normal">7</span>
|
|
<span class="normal">8</span>
|
|
<span class="normal">9</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="s1">'HR.areaS'</span>
|
|
<span class="k">select</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="p">:</span><span class="n">foo</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">area_id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">area_name</span><span class="w"> </span>
|
|
<span class="c1">---------+------------------------</span>
|
|
<span class="w"> </span><span class="mi">4</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Iron</span>
|
|
<span class="w"> </span><span class="mi">3</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Desert</span>
|
|
<span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Wood</span>
|
|
<span class="w"> </span><span class="mi">2</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Lake</span>
|
|
<span class="p">(</span><span class="mi">4</span><span class="w"> </span><span class="k">rows</span><span class="p">)</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_afa56300821c4406395fc32601a045e87">The above command queries the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b19821164012017">HR.areaS</strong> table.</p>
|
|
<div class="notice" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_n911444d5daaa43dcb6491a356dbbf9d2"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a93dd96d7a81646358e0b48d4d8529982">The value of a variable is copied character by character, and even an asymmetric quote mark or backslash (\) is copied. Therefore, the input content must be meaningful.</p>
|
|
</div></div>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_ul9873448491"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li148738487919"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_li148738487919"></a><a name="en-us_topic_0000001233922133_li148738487919"></a>The following is an example of using the special variable <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b113758980194248">CONVERT_QUOTE_IN_DYNAMIC_PARAM</strong>:</li></ul>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p7207256151012">If <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b4968202453011">CONVERT_QUOTE_IN_DYNAMIC_PARAM</strong> is set to true, quotation marks and backslashes in variables are automatically escaped during SQL substitution.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_screen98057495595"><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>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span>
|
|
<span class="normal">11</span>
|
|
<span class="normal">12</span>
|
|
<span class="normal">13</span>
|
|
<span class="normal">14</span>
|
|
<span class="normal">15</span>
|
|
<span class="normal">16</span>
|
|
<span class="normal">17</span>
|
|
<span class="normal">18</span>
|
|
<span class="normal">19</span>
|
|
<span class="normal">20</span>
|
|
<span class="normal">21</span>
|
|
<span class="normal">22</span>
|
|
<span class="normal">23</span>
|
|
<span class="normal">24</span>
|
|
<span class="normal">25</span>
|
|
<span class="normal">26</span>
|
|
<span class="normal">27</span>
|
|
<span class="normal">28</span>
|
|
<span class="normal">29</span>
|
|
<span class="normal">30</span></pre></div></td><td class="code"><div><pre><span></span><span class="w"> </span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">DYNAMIC_PARAM_ENABLE</span><span class="w"> </span><span class="k">true</span>
|
|
<span class="w"> </span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">CONVERT_QUOTE_IN_DYNAMIC_PARAM</span><span class="w"> </span><span class="k">true</span>
|
|
<span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="s1">'""abc''''\\'</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="ss">"SpecialCharacters"</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">test</span>
|
|
<span class="c1">-----------</span>
|
|
<span class="w"> </span><span class="ss">""</span><span class="n">abc</span><span class="s1">''</span><span class="err">\\</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
|
|
<span class="c1">-- Single quotation marks are escaped, but still displayed in the result.</span>
|
|
<span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="s1">'${SpecialCharacters}'</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="ss">"test"</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">test</span>
|
|
<span class="c1">-----------</span>
|
|
<span class="w"> </span><span class="ss">""</span><span class="n">abc</span><span class="s1">''</span><span class="err">\\</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
|
|
<span class="c1">-- Single quotation marks and backslashes are escaped, but still displayed in the result.</span>
|
|
<span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="n">E</span><span class="s1">'${SpecialCharacters}'</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="ss">"test"</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">test</span>
|
|
<span class="c1">-----------</span>
|
|
<span class="w"> </span><span class="ss">""</span><span class="n">abc</span><span class="s1">''</span><span class="err">\\</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
|
|
<span class="c1">-- Double quotation marks are escaped, but still displayed in the result.</span>
|
|
<span class="c1">-- The column name contains characters other than letters, digits, and underscores (_). Therefore, an error occurred.</span>
|
|
<span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="s1">'test'</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="ss">"${SpecialCharacters}"</span><span class="p">;</span>
|
|
<span class="n">error</span><span class="w"> </span><span class="n">while</span><span class="w"> </span><span class="n">saving</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="ss">""</span><span class="n">abc</span><span class="s1">''</span><span class="err">\\</span><span class="p">,</span><span class="w"> </span><span class="n">please</span><span class="w"> </span><span class="k">check</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="k">column</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="n">which</span><span class="w"> </span><span class="n">can</span><span class="w"> </span><span class="k">only</span><span class="w"> </span><span class="n">contain</span><span class="w"> </span><span class="k">upper</span><span class="w"> </span><span class="k">and</span><span class="w"> </span><span class="k">lower</span><span class="w"> </span><span class="k">case</span><span class="w"> </span><span class="n">letters</span><span class="p">,</span><span class="w"> </span><span class="n">numbers</span><span class="w"> </span><span class="k">and</span><span class="w"> </span><span class="s1">'_'</span><span class="p">.</span>
|
|
<span class="w"> </span><span class="ss">""</span><span class="n">abc</span><span class="s1">''</span><span class="err">\\</span>
|
|
<span class="c1">-----------</span>
|
|
<span class="w"> </span><span class="n">test</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>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p11951155041115">When <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b259415590374">CONVERT_QUOTE_IN_DYNAMIC_PARAM</strong> is set to false, strings in the variable are not processed during SQL substitution. You need to manually escape the strings as needed</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_note16574035131712"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p54791052113">You are advised to use the default value <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b122091557405">true</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_p683533102018">During SQL substitution, single quotation marks need to be escaped in <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b14749195416481">''</strong>, single quotation marks and backslashes need to be escaped in <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b873813492483">E''</strong>, and double quotation marks need to be escaped in <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_b42647114917">""</strong>. Quotation marks and backslashes need to be handled based on variable positions. This makes the variable logics in SQL substitution complex and error-prone.</p>
|
|
</div></div>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_screen206799453014"><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>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span>
|
|
<span class="normal">11</span>
|
|
<span class="normal">12</span>
|
|
<span class="normal">13</span>
|
|
<span class="normal">14</span>
|
|
<span class="normal">15</span>
|
|
<span class="normal">16</span>
|
|
<span class="normal">17</span>
|
|
<span class="normal">18</span>
|
|
<span class="normal">19</span>
|
|
<span class="normal">20</span>
|
|
<span class="normal">21</span>
|
|
<span class="normal">22</span>
|
|
<span class="normal">23</span>
|
|
<span class="normal">24</span>
|
|
<span class="normal">25</span>
|
|
<span class="normal">26</span>
|
|
<span class="normal">27</span>
|
|
<span class="normal">28</span>
|
|
<span class="normal">29</span>
|
|
<span class="normal">30</span></pre></div></td><td class="code"><div><pre><span></span><span class="w"> </span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">DYNAMIC_PARAM_ENABLE</span><span class="w"> </span><span class="k">true</span>
|
|
<span class="w"> </span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">CONVERT_QUOTE_IN_DYNAMIC_PARAM</span><span class="w"> </span><span class="k">false</span>
|
|
<span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="s1">'""abc''''\\'</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="ss">"SpecialCharacters"</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">test</span>
|
|
<span class="c1">-----------</span>
|
|
<span class="w"> </span><span class="ss">""</span><span class="n">abc</span><span class="s1">''</span><span class="err">\\</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
|
|
<span class="c1">-- Single quotation marks are not escaped. The result contains only one single quotation mark.</span>
|
|
<span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="s1">'${SpecialCharacters}'</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="ss">"test"</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">test</span>
|
|
<span class="c1">----------</span>
|
|
<span class="w"> </span><span class="ss">""</span><span class="n">abc</span><span class="s1">'\\</span>
|
|
<span class="s1">(1 row)</span>
|
|
|
|
<span class="s1">-- Single quotation marks and backslashes are not escaped. The result contains only one single quotation mark and one backslash.</span>
|
|
<span class="s1"> select E'</span><span class="err">${</span><span class="n">SpecialCharacters</span><span class="err">}</span><span class="s1">' as "test";</span>
|
|
<span class="s1"> test</span>
|
|
<span class="s1">---------</span>
|
|
<span class="s1"> ""abc'</span><span class="err">\</span>
|
|
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
|
|
|
<span class="c1">-- Double quotation marks are not escaped. The result contains only one double quotation mark.</span>
|
|
<span class="c1">-- The column name contains characters other than letters, digits, and underscores (_). Therefore, an error occurred.</span>
|
|
<span class="w"> </span><span class="k">select</span><span class="w"> </span><span class="s1">'test'</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="ss">"${SpecialCharacters}"</span><span class="p">;</span>
|
|
<span class="n">error</span><span class="w"> </span><span class="n">while</span><span class="w"> </span><span class="n">saving</span><span class="w"> </span><span class="n">the</span><span class="w"> </span><span class="n">value</span><span class="w"> </span><span class="k">of</span><span class="w"> </span><span class="ss">"abc''\\, please check the column name which can only contain upper and lower case letters, numbers and '_'.</span>
|
|
<span class="ss"> "</span><span class="n">abc</span><span class="s1">''</span><span class="err">\\</span>
|
|
<span class="c1">----------</span>
|
|
<span class="w"> </span><span class="n">test</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>
|
|
</li></ul>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_udbbf453f84764f98926ea90a21378cb8"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_laa92fb04b10c4ba18fd3cb8b192e5756"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_laa92fb04b10c4ba18fd3cb8b192e5756"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_laa92fb04b10c4ba18fd3cb8b192e5756"></a>Prompt<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aa58b9c28787f4a2a9572f4744b52bf95"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_laa92fb04b10c4ba18fd3cb8b192e5756"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_laa92fb04b10c4ba18fd3cb8b192e5756"></a>The gsql prompt can be set using the three variables in <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tcbb1ddded09e46228348d96ff1af36e8">Table 3</a>. These variables consist of characters and special escape characters.</p>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tcbb1ddded09e46228348d96ff1af36e8"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_tcbb1ddded09e46228348d96ff1af36e8"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tcbb1ddded09e46228348d96ff1af36e8" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Prompt variables</caption><thead align="left"><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r42acb12000d04cb08b3964d069b2491e"><th align="left" class="cellrowborder" valign="top" width="12%" id="mcps1.3.2.6.1.2.2.4.1.1"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ac9186ae39e02450d8a1947dadabb4117">Variable</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="35%" id="mcps1.3.2.6.1.2.2.4.1.2"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a649a1d4e95e34d96a8a0596afc211ce7">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="53%" id="mcps1.3.2.6.1.2.2.4.1.3"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a047a73844cdd4dc7aa8e5ec26013c3c3">Example</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r58d73e50f0714156aff01fabb643603c"><td class="cellrowborder" valign="top" width="12%" headers="mcps1.3.2.6.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a95cd0541dc4a4275ad76f62017c9c321">PROMPT1</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.2.6.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_acb7288603ae7466f8b8266e766a41c14">Specifies the normal prompt used when gsql requests a new command.</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a3409e119a4944638b771ece9092e0999">The default value of <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i842352697164513">PROMPT1</em> is:</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sd9c5ed5d7b904fc8808a8d6c28abb63d">%/%R%#</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53%" headers="mcps1.3.2.6.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a6e2ddb7622ba4ee18f0070d3e99c4e1f"><em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i84235269712055">PROMPT1</em> can be used to change the prompt.</p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ud70e4ecad91d4c44a0a4a79d782ee0af"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l679e2dfdab454b6da66d67f2b5b651af">Change the prompt to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706193243">[local]</strong>:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s8a368f268bda474a90c8b36357f0ed20"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">PROMPT1</span><span class="w"> </span><span class="o">%</span><span class="n">M</span>
|
|
<span class="p">[</span><span class="k">local</span><span class="p">:</span><span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">gaussdba_mppdb</span><span class="p">]</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l688fece740c44a4f9b005f587a4851c3">Change the prompt to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706193230">name</strong>:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s3249531db2874f0e8e115a32cee6f664"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">PROMPT1</span><span class="w"> </span><span class="n">name</span>
|
|
<span class="n">name</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l11a260e6d0d24112af75db6dd93e7560">Change the prompt to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706193226">=</strong>:<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s0d6015ca51554ee291809a0690064be2"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">PROMPT1</span><span class="w"> </span><span class="o">%</span><span class="n">R</span>
|
|
<span class="o">=</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_re28d8f163e14452a8731f289702564b8"><td class="cellrowborder" valign="top" width="12%" headers="mcps1.3.2.6.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a60f1e3f447cb4a7a8821e178c7c4cdae">PROMPT2</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.2.6.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a23f6fe88216c45f0bf94f4d549349251">Specifies the prompt displayed when more command input is expected. For example, it is expected if a command is not terminated with a semicolon (;) or a quote (") is not closed.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53%" headers="mcps1.3.2.6.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ab59cf9b63150428793269a4d3c56a84d"><em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i8423526971218">PROMPT2</em> can be used to display the prompt:</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s10513a1479fa4ed987c82a7727ecf37d"><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>
|
|
<span class="normal">6</span>
|
|
<span class="normal">7</span>
|
|
<span class="normal">8</span>
|
|
<span class="normal">9</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">PROMPT2</span><span class="w"> </span><span class="n">TEST</span>
|
|
<span class="k">select</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="n">HR</span><span class="p">.</span><span class="n">areaS</span><span class="w"> </span><span class="n">TEST</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="n">area_id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">area_name</span><span class="w"> </span>
|
|
<span class="c1">---------+--------------------</span>
|
|
<span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Wood</span>
|
|
<span class="w"> </span><span class="mi">2</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Lake</span>
|
|
<span class="w"> </span><span class="mi">4</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Iron</span>
|
|
<span class="w"> </span><span class="mi">3</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">Desert</span>
|
|
<span class="p">(</span><span class="mi">4</span><span class="w"> </span><span class="k">rows</span><span class="p">))</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r8d96147ed7354932a1c06b47c4de06d6"><td class="cellrowborder" valign="top" width="12%" headers="mcps1.3.2.6.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a52675be466e4447098f007b2f21f192c">PROMPT3</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.2.6.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a244bfdc7e346464a801f5a377bbc3c92">Specifies the prompt displayed when the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270615045">COPY</strong> statement (such as <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270695438">COPY FROM STDIN</strong>) is run and data input is expected.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="53%" headers="mcps1.3.2.6.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a0a3d0166d0b34cbeb4a477d7496dd405"><em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i842352697111042">PROMPT3</em> can be used to display the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270611117">COPY</strong> prompt.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s8eae702972544af0924cacb7ad5326b4"><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>
|
|
<span class="normal">6</span>
|
|
<span class="normal">7</span></pre></div></td><td class="code"><div><pre><span></span><span class="err">\</span><span class="k">set</span><span class="w"> </span><span class="n">PROMPT3</span><span class="w"> </span><span class="s1">'>>>>'</span>
|
|
<span class="k">copy</span><span class="w"> </span><span class="n">HR</span><span class="p">.</span><span class="n">areaS</span><span class="w"> </span><span class="k">from</span><span class="w"> </span><span class="k">STDIN</span><span class="p">;</span>
|
|
<span class="n">Enter</span><span class="w"> </span><span class="k">data</span><span class="w"> </span><span class="k">to</span><span class="w"> </span><span class="n">be</span><span class="w"> </span><span class="n">copied</span><span class="w"> </span><span class="n">followed</span><span class="w"> </span><span class="k">by</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">newline</span><span class="p">.</span>
|
|
<span class="k">End</span><span class="w"> </span><span class="k">with</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">backslash</span><span class="w"> </span><span class="k">and</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="k">period</span><span class="w"> </span><span class="k">on</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="n">line</span><span class="w"> </span><span class="k">by</span><span class="w"> </span><span class="n">itself</span><span class="p">.</span>
|
|
<span class="o">>>>></span><span class="mi">1</span><span class="w"> </span><span class="n">aa</span>
|
|
<span class="o">>>>></span><span class="mi">2</span><span class="w"> </span><span class="n">bb</span>
|
|
<span class="o">>>>></span><span class="err">\</span><span class="p">.</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a76bfb867586e4ebfa19970ed9f73c2ff">The value of the selected prompt variable is printed literally. However, a value containing a percent sign (%) is replaced by the predefined contents depending on the character following the percent sign (%). For details about the defined substitutions, see <a href="#EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_t2d9953fd189b42ada46e619d59bcc909">Table 4</a>.</p>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_t2d9953fd189b42ada46e619d59bcc909"></a><a name="en-us_topic_0000001233922133_en-us_topic_0000001098650792_t2d9953fd189b42ada46e619d59bcc909"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_t2d9953fd189b42ada46e619d59bcc909" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Defined substitutions</caption><thead align="left"><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r3111a829104f48a8b354687d2c42640c"><th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.2.6.1.4.2.3.1.1"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ace20b631f00d4e6ca57148ddf141a8b7">Symbol</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="84%" id="mcps1.3.2.6.1.4.2.3.1.2"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ac0b83dd9a5bc403b91762000a17844c5">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r7d1b04847fe74305a6e296022af06198"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a6550cd6486514785ada4b99df414b657">%M</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ae38b2315fcb94285961a155412983b78">Specifies the full host name (with domain name). The full name is [local] if the connection is over a Unix domain socket, or [local:/dir/name] if the Unix domain socket is not at the compiled default location.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rdb55e8329afa482a8d5fe8db886ad985"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a21882413a52445ba9e0ac4aab6c6a8b3">%m</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_abb7f64e40a584499a876cb1744f05c2f">Specifies the host name truncated at the first dot. It is [local] if the connection is over a Unix domain socket.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rea9e618df4ae4c2c92c86ef078c59bc7"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a556543d0adbd4136935644641eb94add">%></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_afc24d76a73514575b786e5972772fda7">Specifies the number of the port that the host is listening on.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r7edcc702894141e3bb60085a07bf1598"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a458306629c24428f92e77de13ed5989b">%n</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a0690442760104d47b4fbbe215f7674da">Specifies the database session user name.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r575c43565a594ee09c9d131f870fde78"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a2bec34bb9aaf4124baf6c891bbdfda40">%/</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a9c53f4895b9546a48b2e4fcf833fd918">Specifies the name of the current database.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rc605d0bbfbb7476cbf6f5ca9a8dcd0f1"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a23a036e2cc6142ba9f2c902fb3c7d45a">%~</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a643792a329194d6a9911681807b99044">Is similar to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270615230">%/</strong>. However, the output is tilde (~) if the database is your default database.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r726e438284f3455c9974c3cd022fdeb2"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a69d9ec9081a240418f808c88a6e0fdda">%#</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a1572ecf70c784abba7e856e821d10696">Uses <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b84235270615257">#</strong> if the session user is the database administrator. Otherwise, uses <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b8423527061535">></strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rc32fe3ebc144482f8547009231396b39"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aea290a578dd94f5f91c92dd5c1ed6180">%R</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_u465c5fb0a0f8448fb995d68b3f01d581"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l8d6f5ad2beb24f319a119e4bbb824f01">Normally uses <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0085031667_b84235270615320">=</strong> for <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0085031667_i84235269711285">PROMPT1</em>, but <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0085031667_b84235270615332">^</strong> in single-line mode and <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0085031667_b84235270615336">!</strong> if the session is disconnected from the database (which may occur if <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_en-us_topic_0085031667_b842352706112838">\connect</strong> fails).</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l62362d685cb24db99bc6a8ff6e1cbce6">For PROMPT2, the sequence is replaced by a hyphen (-), asterisk (*), single quotation mark ('), double quotation mark ("), or dollar sign ($), depending on whether gsql is waiting for more input, or the query is not terminated, or the query is in the /* ... */ the comment, quotation mark, or dollar sign extension.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r559ac7b393244818a7f97bed0b637a05"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ae2473fec73d74521ac4d9bcf11f9d392">%x</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a2edc7edce1104aedbf12f19036a4cd14">Specifies the transaction status.</p>
|
|
<ul id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_uf0dfbe82a15240f79bee996f85d59c87"><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lde6109c072e64670a31aaaa9677b5513">An empty string when it is not in a transaction block</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_lf49f445f2dfe454daf3a200c1818a136">An asterisk (*) when it is in a transaction block</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l6ab7c1f7a5aa46f0b868a5080651d76f">An exclamation mark (!) when it is in a failed transaction block</li><li id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_l82b9e227dfd04c3894ee9951ee78bce4">A question mark (?) when the transaction status is indeterminate (for example, indeterminate due to no connections).</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r83e63946429b4c779014b2a280dce069"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ade0e69ef70d54a60a40e16903c5ddd50">%digits</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a39e0c1d06fe84057a5c51bf5daf1f5c8">Is replaced with the character with the specified byte.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rbe7cc10f21ce47f7be5c410831c38047"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ac76aff3199bf4b54a0988e68a6152ddf">%:name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a57e7832b35564cde896b97227d495024">Specifies the value of the <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i842352697114052">name</em> variable of gsql.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rce22b3548a474ab4ba1616f42d5c170b"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a9e277fd024f74ec392f174cd5b76a909">%command</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a0e3dc76a1ca548bbb81a9edf9b9b8eec">Specifies command output, similar to ordinary "back-tick" ("^") substitution.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rd22e448b326440bdb99c6d940878f647"><td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.6.1.4.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a3fc4464037c4417492f9e02e38d30e5d">%[ . . . %]</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="84%" headers="mcps1.3.2.6.1.4.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_aabf72779b7344d1a9c24403a0663e663">Prompts can contain terminal control characters which, for example, change the color, background, or style of the prompt text, or change the title of the terminal window. For example:</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a5aab70408463441b847b3c7063b28ed3">potgres=> \set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%#'</p>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a7d96498829294661a87cc88f94dcb3ec">The output is a boldfaced (1;) yellow-on-black (33;40) prompt on VT100-compatible, color-capable terminals.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_sfc578d680b0e40d593a0ff88f724be73"><h4 class="sectiontitle">Environment Variables</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_tc11c4f6be24b455cbe3bb6fac683a767" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Environment variables related to gsql</caption><thead align="left"><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rf6e11127723d46f58d2d6102128e2f21"><th align="left" class="cellrowborder" valign="top" width="29.14%" id="mcps1.3.3.2.2.3.1.1"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a83d2611368b748eea967d734be7e79de">Name</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="70.86%" id="mcps1.3.3.2.2.3.1.2"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a8e60f799c6a14eaea98176c5b04591f0">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rd227175abcd04cb78434973b79512560"><td class="cellrowborder" valign="top" width="29.14%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a3eea56dad5f84ac08c1850ff0a0f1d47">COLUMNS</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.86%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ae62e24dc14a74eba8fa26fcb3ce3d889">If <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b231812872815">\set columns</strong> is set to <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b133186802810">0</strong>, this parameter controls the width of the wrapped format. This width determines whether the width output mode is changed to a vertical bar format in automatic expansion mode.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r800d281fe45b4604b03e841df214a376"><td class="cellrowborder" valign="top" width="29.14%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a9efe5dae4beb4f68884b10711ea63a98">PAGER</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.86%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ab9e27697a82a48ac8c552a5d948980f4">If the query result cannot be displayed within one page, the query result will be redirected to the command. You can use the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b15381133042010">\pset</strong> command to disable the pager. Typically, the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b544475019204">more</strong> or <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b4460165019208">less</strong> command is used for viewing the query result page by page. The default value is platform-associated.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ndb0df800ad4f48708064f4e754b1c098"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a3ff2824dc62a4702bf27a379d5128356">Display of the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706115224">less</strong> command is affected by the <em id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_i84235269712127">LC_CTYPE</em> environmental variable.</p>
|
|
</div></div>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r263bb719f2a743f2a028c803ca51c659"><td class="cellrowborder" valign="top" width="29.14%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a074f1ffa41dc48dbb0bfaf59fd2fcfce">PSQL_EDITOR</p>
|
|
</td>
|
|
<td class="cellrowborder" rowspan="3" valign="top" width="70.86%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a2942ab1fba5c471bafefb36a1db9caf6">The <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b20318138192813">\e</strong> and <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b18318188283">\ef</strong> commands use the editor specified by the environment variables. Variables are checked according to the list sequence. The default editor on Unix is vi.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r459e1f2ad0094872985b306e8ec784a7"><td class="cellrowborder" valign="top" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a5c6586c316ba4132ab36a3be6ad53bcc">EDITOR</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rdbb3f25165bb4b08be2355001f71b308"><td class="cellrowborder" valign="top" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a91fbcd627da54ea78b8bbe75ef9d0366">VISUAL</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rba4edd1743ee4d71ac5cde99b3eb85a3"><td class="cellrowborder" valign="top" width="29.14%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a3bdf8d217b6e45068e4b4d57105d7118">PSQL_EDITOR_LINENUMBER_ARG</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.86%" headers="mcps1.3.3.2.2.3.1.2 "><div class="p" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ac0a29094653448338c1fde151656a68a">When the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706115455">\e</strong> or <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b842352706115459">\ef</strong> command is used with a line number parameter, this variable specifies the command-line parameter used to pass the starting line number to the editor. For editors, such as Emacs or vi, this is a plus sign. A space is added behind the value of the variable if whitespace is required between the option name and the line number. For example:<pre class="screen" id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_s991f011bb6e44356aee5fd967825884f">PSQL_EDITOR_LINENUMBER_ARG = '+'
|
|
PSQL_EDITOR_LINENUMBER_ARG='--line '</pre>
|
|
</div>
|
|
<p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_acc083afa487547889d566083661de62b">A plus sign (+) is used by default on Unix.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rb92fa3e6055c48169a327a1dd704faf0"><td class="cellrowborder" valign="top" width="29.14%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a5c897ed7037c4f55a6a2b0c78581d72b">PSQLRC</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.86%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a321705182c92443eab14f3bb2d3af57f">Specifies the location of the user's .gsqlrc file.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_r5f704041339e4aaba55c6d7e26b47c26"><td class="cellrowborder" valign="top" width="29.14%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_ae646387813ae46dbabadaf659dd9dca3">SHELL</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.86%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a7c94a9b98b0a4549b5a2d9a4a2c958dc">Has the same effect as the <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b1531910812281">\!</strong> command.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_rb331bf8811b14fefad263bb1267f29d2"><td class="cellrowborder" valign="top" width="29.14%" headers="mcps1.3.3.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_a442298216cd5403a9411e3b4b87448c1">TMPDIR</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="70.86%" headers="mcps1.3.3.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_affd2e41b89ff43409449488ecd0233b2">Specifies the directory for storing temporary files. The default value is <strong id="EN-US_TOPIC_0000001234200693__en-us_topic_0000001233922133_en-us_topic_0000001098650792_b17319148132819">/tmp</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_gsql_index.html">gsql</a></div>
|
|
</div>
|
|
</div>
|
|
|