doc-exports/docs/dws/dev/dws_04_0515.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

160 lines
14 KiB
HTML

<a name="EN-US_TOPIC_0000001188163650"></a><a name="EN-US_TOPIC_0000001188163650"></a>
<h1 class="topictitle1">Data Type Conversion</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188163650__en-us_topic_0059778807_p423612312619">Certain data types in the database support implicit data type conversions, such as assignments and parameters invoked by functions. For other data types, you can use the type conversion functions provided by <span id="EN-US_TOPIC_0000001188163650__text1046434651">GaussDB(DWS)</span>, such as the CAST function, to forcibly convert them.</p>
<p id="EN-US_TOPIC_0000001188163650__adc3833a6390c48569abf201edba6ffc6"><a href="#EN-US_TOPIC_0000001188163650__t766dc94ed85840d28e897ff107682ca2">Table 1</a> lists common implicit data type conversions in <span id="EN-US_TOPIC_0000001188163650__text2055270629">GaussDB(DWS)</span>.</p>
<div class="notice" id="EN-US_TOPIC_0000001188163650__n3267aa20d49f4244ad669d314024ba77"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><p id="EN-US_TOPIC_0000001188163650__a9f3f7ba3fc534e7580dc6fcfe0661112">The valid value range of DATE supported by <span id="EN-US_TOPIC_0000001188163650__text1284083209">GaussDB(DWS)</span> is from 4713 B.C. to 294276 A.D.</p>
</div></div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001188163650__t766dc94ed85840d28e897ff107682ca2"></a><a name="t766dc94ed85840d28e897ff107682ca2"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188163650__t766dc94ed85840d28e897ff107682ca2" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Implicit data type conversions</caption><thead align="left"><tr id="EN-US_TOPIC_0000001188163650__rc295bfaa71714e82becd078e9661dea5"><th align="left" class="cellrowborder" valign="top" width="32.15678432156784%" id="mcps1.3.4.2.4.1.1"><p id="EN-US_TOPIC_0000001188163650__a7f0ffd72eb244167ba839900983e99b6">Raw Data Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="32.15678432156784%" id="mcps1.3.4.2.4.1.2"><p id="EN-US_TOPIC_0000001188163650__aa3511ce3765d4f62ba0f504a9a47cfc8">Target Data Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="35.68643135686431%" id="mcps1.3.4.2.4.1.3"><p id="EN-US_TOPIC_0000001188163650__ad9740e19353642be8c6516e1a6ff95cf">Remarks</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188163650__rf80a09cfa19444119f76577c8eefccd3"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a8b17bfb76c5d47ac8e675ca7fb5c8f56">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a677b2f370bd04d75b9844a3f0a8f1f84">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a71a4db6b05c74055ba6143441457bfdc">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__rba6f94bd69e341bdbf75a968453b31bd"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__aa7137a3e45684731ba9ecc40ef50d61a">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a82cc26c250df4afba34340ed16601bb8">NUMBER</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a9418b3570b394e2182bc64cc92d514cc">Raw data must consist of digits.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__rca9839af48064b2eaf8c396f3647073f"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a332ffa64c7804b68af1ae97880ce7824">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__ad76ab9cb20f1469d89aad6d8016e27ea">DATE</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a4e25a27a0f1f413ab95823e206bd8808">Raw data cannot exceed the valid date range.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r09551c523d6340dc892f66761b0fe248"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a7ff0920f28e448109f8eee058daaa413">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a5044f387df8a41a4afc874fba20d77bc">RAW</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__ae7b02ee1b9ed4b23a4093f312395eff8">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r8948f286aa7748e0bec8756730155acb"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__afb7d27d978ac4c9c81601e077cba5f39">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__ac62c750c32f34c48bc4e4738acf221c0">CLOB</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a6bd9340d4260489c81018ae40ef64532">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r421e0b9b2cae4929a269e87aba5f5746"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__af54a291dfc9a4feaab885016912b3df0">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a745ad078a4b84dbea11c836b24e69abc">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__aa4774af5f16342cea643e83e6b4cefe9">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r25dff6f7dab34c5cb312a50f32ac4b1a"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a08b20867125c4f7f88ef14619905176a">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a81cb587b06d6408a9c20657c7c8130bc">NUMBER</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a2a38e2f238ca4e8ba8e3a8c1fc4ebe20">Raw data must consist of digits.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__rd36f1a58eccd4a8385c27275c0fab16a"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a49abca0daafd476a96d4dcbdb644175e">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a3c5fd323a62043de9849862985278642">DATE</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a6c974c5f6dce4e148a8006d373c74506">Raw data cannot exceed the valid date range.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r91e2894e75b24c869af57deb090ec991"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a6f48bdcda5d448e983ef3d2c1acce274">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a66759ef1bb214139b0ae55a5791a2f84">CLOB</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a14fd7682348f48c880d1eaa0d03257b1">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r524a370defe74b85a08b73002888b6cc"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__acd113b8f1b0b4dce938b6726afd910cc">NUMBER</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a96dd718715c6452a953f8038f3b7fe10">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a47daa1047ce14fa79e5d7449a4b7a390">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r8a209c50ca5f4b829ce583fe6155ce3f"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a731bc682eb854c7e8ae43a4b6b10cc12">NUMBER</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__ac74358b8b0f642fab7254d68e79477c6">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__aa4198d278e2d4f968323995268f7b8d9">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__rcf1edf884a634af0bcd65d30a7f72cac"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a12b7faf02cca4a08a47df06a91e21555">DATE</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__acc0b07478aae4c83ab39849a42902f74">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a19a091fa12ce446fbe6f0d9d7280fee4">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r007e75a01c2f4413ae6be0076f61cf34"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a0f8beae9acff4f578d2a8b5b02fd918a">DATE</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a4a2fc730fb14408e9e8b8e662f209928">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a5bb6c410a03944a3a0c63d8aeea8ae53">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r1ed41106b3d54540b9e431564b909948"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a674e4c212c804277a69ebed3973992db">RAW</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__afd0aa49ba8574ff184dce002a69f4e10">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a088aec42bd1c49fe8af2a975ee600e26">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r4f313aad4263408fa30ae20807087dd1"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a688269d7b6974d96b3c191eb038b2ddc">RAW</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a58d9c918b91847aea28c22983561313d">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a6a0612aa74b04187b957f6f7def36b0f">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r46c394205e664f01afe98ea302eb7010"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__adc77c05737ea42599b489f1942252b50">CLOB</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__ad8a24de985564e05955360830e6d408e">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__accd00431e587401d90c0101b0ab774ae">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__re47a1400aa254f3fa343e13ce465aee4"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a4b668eae587b47bd8b39b478085439d3">CLOB</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a20db1558dcee4bc08218f73991cd000e">VARCHAR2</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__abd917cfb20554e59a60253042b42d92a">-</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r8e098617e18e4266a99b42ea9cb5ca1b"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a2db9ac1c07d445ea8b8178d9197aac32">CLOB</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__a08a633ff024b43fe859321516920a10d">NUMBER</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a8c006104eb974324b24a3d7baa96c50c">Raw data must consist of digits.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188163650__r06f01ba90822452fadb4fa9659d68fd8"><td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.1 "><p id="EN-US_TOPIC_0000001188163650__a6f390775ced84b83ad966a58f0b99f94">INT4</p>
</td>
<td class="cellrowborder" valign="top" width="32.15678432156784%" headers="mcps1.3.4.2.4.1.2 "><p id="EN-US_TOPIC_0000001188163650__abe17401f9e6f4a2791cd310c3e992c86">CHAR</p>
</td>
<td class="cellrowborder" valign="top" width="35.68643135686431%" headers="mcps1.3.4.2.4.1.3 "><p id="EN-US_TOPIC_0000001188163650__a15273d73a86b4f70893007f990ce331f">-</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0512.html">Stored Procedures</a></div>
</div>
</div>