{"id":554,"date":"2019-05-15T08:47:20","date_gmt":"2019-05-15T00:47:20","guid":{"rendered":"http:\/\/www.hefeiyu.com\/?p=554"},"modified":"2019-05-15T08:47:48","modified_gmt":"2019-05-15T00:47:48","slug":"bdl-fgl_base-%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b1","status":"publish","type":"post","link":"https:\/\/www.hefeiyu.com\/?p=554","title":{"rendered":"BDL-FGL_BASE \u6570\u636e\u7c7b\u578b(1)"},"content":{"rendered":"<div id=\"content_views\" class=\"htmledit_views\">\n<p>\u6570\u636e\u7c7b\u578b<\/p>\n<p>\u9009\u62e9\u6b63\u786e\u7684\u6570\u636e\u7c7b\u578b\u6709\u52a9\u4e8e\u8f93\u5165,\u5b58\u50a8\u548c\u663e\u793a\u6570\u636e.<\/p>\n<div class=\"table-box\">\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\">\u6570\u636e\u7c7b\u578b<\/td>\n<td valign=\"top\">\u63cf\u8ff0<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">BIGINT<\/td>\n<td valign=\"top\">\u00a08\u5b57\u8282\u6709\u7b26\u53f7\u6574\u5f62<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">BOOLEAN<\/td>\n<td valign=\"top\">\u00a0\u5e03\u5c14\u7c7b\u578b<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">BYTE<\/td>\n<td valign=\"top\">\u00a0\u4e8c\u8fdb\u5236\u5927\u6570\u636e\uff08\u56fe\u7247\uff09<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">CHAR[(n)]<\/td>\n<td valign=\"top\">\u00a0\u56fa\u5b9a\u957f\u5ea6\u7684\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">DATE<\/td>\n<td valign=\"top\">\u00a0\u7b80\u5355\u65e5\u5386\u65e5\u671f\u7c7b\u578b<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">DATETIME q1 TO q2<\/td>\n<td valign=\"top\">\u00a0\u9ad8\u7cbe\u786e\u65e5\u671f\u548c\u5c0f\u65f6\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">DECIMAL[(P[,s])]<\/td>\n<td valign=\"top\">\u00a0\u9ad8\u7cbe\u5ea6\u5341\u8fdb\u5236\u5c0f\u6570<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">FLOAT[(P)]<\/td>\n<td valign=\"top\">\u00a08\u5b57\u8282\u5341\u8fdb\u5236\u6d6e\u70b9<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">INTEGER<\/td>\n<td valign=\"top\">\u00a04\u5b57\u8282\u6709\u7b26\u53f7\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">INTERVAL q1 TO q2<\/td>\n<td valign=\"top\">\u00a0\u9ad8\u7cbe\u5ea6\u65f6\u95f4\u95f4\u9694<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">MONEY[(p[,s])]<\/td>\n<td valign=\"top\">\u00a0\u9ad8\u7cbe\u5ea6\u5341\u8fdb\u5236\u8d27\u5e01\u683c\u5f0f<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">SMALLFLOAT<\/td>\n<td valign=\"top\">\u00a04\u5b57\u8282\u5341\u8fdb\u5236\u6d6e\u70b9<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">SMALLINT<\/td>\n<td valign=\"top\">\u00a02\u5b57\u8282\u6709\u7b26\u53f7\u6574\u5f62<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">STRING<\/td>\n<td valign=\"top\">\u00a0\u52a8\u6001\u957f\u5ea6\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">TINYINT<\/td>\n<td valign=\"top\">\u00a01\u5b57\u8282\u6709\u7b26\u53f7\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">TEXT<\/td>\n<td valign=\"top\">\u00a0\u5927\u578b\u6587\u672c\u6570\u636e(\u7eaf\u6587\u672c)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">VARCHAR[(n[,r])]<\/td>\n<td valign=\"top\">\u00a0\u53ef\u53d8\u957f\u5ea6\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>&nbsp;<\/p>\n<p>BIGINT<\/p>\n<p>BIGINT\u6570\u636e\u7c7b\u578b\u7528\u6765\u5b58\u50a8\u975e\u5e38\u5927\u7684\u6574\u5f62\u6570\u5b57\u3002<\/p>\n<p>\u8bed\u6cd5 BIGINT<\/p>\n<p>\u7528\u6cd5<\/p>\n<p>BIGINT\u53d8\u91cf\u5b58\u50a8\u57fa\u4e8e8\u5b57\u8282\uff0864\u4f4d\uff09\u7684\u6709\u7b26\u53f7\u6570\u636e\u7c7b\u578b<\/p>\n<p>\u6570\u636e\u7684\u503c\u8303\u56f4\u4ece-9,223,372,036,854,775,807 \u5230 +9,223,372,036,854,775,807.<\/p>\n<p>BIGINT\u53d8\u91cf\u53ef\u4ee5\u7528\u6574\u5f62\u6570\u5b57\u521d\u59cb\u5316<\/p>\n<p>&nbsp;<\/p>\n<p>MAIN<br \/>\nDEFINE i BIGINT<br \/>\nLET i = 9223372036854775600<br \/>\nDISPLAY i<br \/>\nEND MAIN<\/p>\n<p>\u5f53\u5206\u914d\u4e00\u4e2a\u6574\u5f62\u6570\u5b57\u8d85\u8fc7BIGINT\u7684\u8303\u56f4\u65f6\uff0c\u5c06\u4f1a\u4ea7\u751f\u6ea2\u51fa\u9519\u8bef -1284\u3002<\/p>\n<p>BIGINT \u53d8\u91cf\u5728\u51fd\u6570\uff0c\u6a21\u5757\uff0c\u548c\u5168\u5c40\u53d8\u91cf\u4e2d\u88ab\u521d\u59cb\u5316\u4e3a0\u3002<\/p>\n<p>BYTE<\/p>\n<p>BYTE\u7c7b\u578b\u5b58\u50a8\u4efb\u4f55\u4e8c\u8fdb\u5236\u6570\u636e\uff0c\u6bd4\u5982\u56fe\u50cf\u6216\u8005\u58f0\u97f3\u3002<\/p>\n<p>\u8bed\u6cd5 BYTE<\/p>\n<p>\u7528\u6cd5\uff1a<\/p>\n<p>\u4e00\u4e2aBYTE \u6216\u8005 TEXT \u53d8\u91cf\u7528\u6765\u5904\u7406\u5b58\u50a8\u4e0e\u6587\u4ef6\u6216\u8005\u5185\u5b58\u7684\u5927\u578b\u5bf9\u8c61(LOB)\u3002\u8fd9\u79cd\u6570\u636e\u7c7b\u578b\u662f\u590d\u6742\u7c7b\u578b\uff0c\u4e0d\u80fd\u50cf<\/p>\n<p>INTEGER \u6216 CHAR \u57fa\u672c\u7c7b\u578b\u4e00\u6837\u4f7f\u7528\u3002\u5b83\u88ab\u7528\u6765\u5904\u7406\u5927\u91cf\u6570\u636e\uff0c\u548c\u7b80\u5355\u7c7b\u578b\u7684\u8bed\u6cd5\u4e0d\u540c\u3002\u4e0e\u7b80\u5355\u6570\u636e\u7c7b\u578b\u4e0d<\/p>\n<p>\u540c\u7684\u662f\uff0c\u5728\u4f7f\u7528BYTE \u548cTEXT\u53d8\u91cf\u524d\uff0c\u5fc5\u987b\u7528LOCATE \u6307\u4ee4\u652f\u6307\u51fa\u5b9e\u9645\u7684\u5b58\u50a8\u4f4d\u7f6e\u3002<\/p>\n<p>BYTE\u548cTEXT\u53d8\u91cf\u53ef\u4ee5\u5904\u7406\u7684\u6700\u5927\u6570\u636e\u7406\u8bba\u4e0a\u4e3a2\u768431\u6b21\u65b9\u5b57\u8282\u5927\u5c0f\u3002\u4f46\u662f\u5b9e\u9645\u5927\u5c0f\u53d7\u9650\u4e8e\u5904\u7406\u6570\u636e\u5b9e\u9645\u53ef\u7528\u7684<\/p>\n<p>\u5185\u5b58\u6216\u8005\u78c1\u76d8\u8d44\u6e90\u3002<\/p>\n<p>BYTE\u548cTEXT\u53d8\u91cf\u5728\u4f7f\u7528\u524d\u5fc5\u987b\u7528LOCATE\u6307\u4ee4\u521d\u59cb\u5316\u3002LOCATE\u6307\u4ee4\u57fa\u672c\u4e0a\u5b9a\u4e49\u4e86\u5927\u6570\u636e\u5bf9\u8c61\u5fc5\u987b\u5b58\u50a8\u7684\u5730\u65b9<\/p>\n<p>\uff08\u5728\u547d\u540d\u6587\u4ef6\u4e2d\uff0c\u5728\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u6216\u5728\u5185\u5b58\u4e2d\uff09\u3002\u8fd9\u4e2a\u6307\u4ee4\u5c06\u5b9e\u9645\u5141\u8bb8\u6293\u53d6LOB\u5230\u5185\u5b58\u6216\u8005\u6587\u4ef6\uff0c\u6216\u8005\u4ece\u5185\u5b58<\/p>\n<p>\u6216\u6587\u4ef6\u4e2d\u628aLOB\u63d2\u5165\u6570\u636e\u5e93\u3002\u5f53\u5b58\u50a8\u5728\u4e34\u65f6\u6587\u4ef6\u65f6\uff08IN FILE\uff09\uff0c\u4e34\u65f6\u6587\u4ef6\u76ee\u5f55\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf DBTEMP\u5b9a\u4e49\u3002<\/p>\n<p>DEFINE t TEXT<br \/>\nLET t = &#8220;aaaa&#8221; \u2013 \u65e0\u6548\uff0c\u6ca1\u6709\u5206\u914d<br \/>\nLOCATE t IN MEMORY<br \/>\nLET t = &#8220;aaaa&#8221; \u2013\u6709\u6548\uff0c\u73b0\u5728\u4f4d\u4e8e\u5185\u5b58\u4e2d<\/p>\n<p>\u5229\u7528BYTE \u548c TEXT \u7c7b\u578b\uff0c\u53ef\u4ee5\u63d2\u5165\u3001\u66f4\u65b0\u3001\u6293\u53d6\u6570\u636e\u5e93\u4e2d\u7684\u5927\u5bf9\u8c61\u3002\u672c\u5730\u6570\u636e\u5e93\u7c7b\u578b\u7684\u4f7f\u7528\u4f9d\u8d56\u6570\u636e\u5e93\u670d\u52a1\u5668<\/p>\n<p>\u7c7b\u578b\u3002 \u5728\u5b9a\u4e49\u4e86\u5927\u5bf9\u8c61\u53e5\u67c4\u5b58\u50a8\uff08LOCATE\uff09\u540e\uff0c\u52a0\u8f7d\u3001\u5206\u914d\u5b83\u7684\u503c\u548c\u5728SQL\u8bed\u53e5\u4e2d\u76f4\u63a5\u4f7f\u7528\u5b83\uff0c\u6216\u8005\u4ece\u6570\u636e\u5e93<\/p>\n<p>\u5927\u5bf9\u8c61\u680f\u83b7\u53d6\u6570\u636e\uff0c\u548c\u7b80\u5355\u7c7b\u578b\u4e00\u6837\u3002<\/p>\n<p>DEFINE t1, t2 TEXT<br \/>\n&#8230;<br \/>\nCREATE TABLE mytable ( id INT, data TEXT )<br \/>\n&#8230;<br \/>\nLOCATE t1 IN MEMORY<br \/>\nCALL t1.readFile(&#8220;lob.4gl&#8221;)<br \/>\nINSERT INTO mytable VALUES ( 1, t1 )<br \/>\nLOCATE t2 IN FILE<br \/>\nSELECT data INTO t2 FROM mytable WHERE id=1<br \/>\n&#8230;<\/p>\n<p>BYTE\u548cTEXT\u7c7b\u578b\u5b9e\u73b0\u4e86 readFile() \u548c writeFile() \u65b9\u6cd5\u636e\u4ece\u6587\u4ef6\u8bfb\u6574\u4e2a\u5927\u5bf9\u8c61\u6570\u636e\u548c\u5199\u6574\u4e2a\u5927\u5bf9\u8c61\u6570\u636e\u5230\u6587\u4ef6\u3002<\/p>\n<p>\u8fd9\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u548c\u5176\u4ed6\u8f6f\u4ef6\u7ec4\u4ef6\u7b80\u5355\u914d\u5408\u4f7f\u7528\uff1a<\/p>\n<p>DEFINE t TEXT<br \/>\nLOCATE t IN MEMORY<br \/>\nCALL t.readFile(&#8220;orig.txt&#8221;)<br \/>\nCALL t.writeFile(&#8220;copy.txt&#8221;<\/p>\n<p>\u5f53\u521d\u59cb\u5316BYTE \u6216 TEXT \u53d8\u91cf\u4e3aNULL\uff08\u521d\u59cb\u5316\u53d8\u91cf\u4e3aNULL\uff09\uff0c\u5047\u5982\u53d8\u91cf\u5206\u914d\u4e3a\u4e00\u4e2a\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4f1a\u88ab\u88c1\u526a(\u6587<\/p>\n<p>\u4ef6\u5927\u5c0f\u5c06\u4e3a0)\u3002\u5047\u5982\u53d8\u91cf\u5206\u914d\u5728\u5185\u5b58\uff0c\u5185\u5b58\u6570\u636e\u4e5f\u4f1a\u88ab\u88c1\u526a\u3002\u968f\u540e\u53d8\u91cf\u7684\u4f7f\u7528(\u6bd4\u5982\uff1aFETCH INTO \u6216 LET \u5206\u914d)<\/p>\n<p>\u4f9d\u7136\u662f\u53ef\u4ee5\u7684\uff1a<\/p>\n<p>DEFINE b BYTE<br \/>\nLOCATE b IN FILE &#8220;picture.png&#8221;<br \/>\nINITIALIZE b TO NULL<br \/>\n&#8212; \u6587\u4ef6&#8221;picture.png&#8221; \u73b0\u5728\u4e3a\u7a7a\u3002<\/p>\n<p>\u5206\u914d\u7ed9BYTE\u6216TEXT\u53d8\u91cf\u7684\u8d44\u6e90\u53ef\u4ee5\u7528FREE\u6307\u4ee4\u91ca\u653e\u3002\u4e00\u4e2aFREE\u6307\u4ee4\u53ef\u4ee5\u79fb\u9664\u5206\u914d\u7ed9LOB\u53d8\u91cf\u7684(\u547d\u540d\u6216\u4e34\u65f6)<\/p>\n<p>\u6587\u4ef6\u3002\u5f53\u5206\u914d\u5728\u5185\u5b58\u4e2d\u65f6\uff0cFREE\u6307\u4ee4\u53ef\u91ca\u653e\u5185\u5b58\u3002\u5728\u91ca\u653e\u4e86LOB\u53d8\u91cf\u7684\u8d44\u6e90\u540e\uff0c\u53ef\u4ee5\u7528LOCATE\u6307\u4ee4\u91cd\u65b0\u5206\u914d\uff1a<\/p>\n<p>DEFINE b BYTE<br \/>\nLOCATE b IN FILE<br \/>\nCALL t.readFile(&#8220;picture.png&#8221;) &#8212; ok<br \/>\nFREE b<br \/>\nCALL t.readFile(&#8220;picture.png&#8221;) \u2013 \u65e0\u6548\uff0c\u6ca1\u6709\u88ab\u5206\u914d<br \/>\nLOCATE b IN MEMORY<br \/>\nCALL t.readFile(&#8220;picture.png&#8221;) \u2013 ok<\/p>\n<p>\u91cd\u8981\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">TEXT\u548cBYTE\u662f\u53c2\u8003\u7c7b\u578b\u3002\u8fd9\u610f\u5473\u7740\u5206\u914d\u4e24\u4e2a\u53d8\u91cf\uff08LET,\u4f20\u9012\u4e00\u4e2a\u53d8\u91cf\u4f5c\u4e3a\u51fd\u6570\u53c2\u6570\uff0c\u51fd\u6570\u8fd4\u56de\u4e00\u4e2a\u503c\uff09\u4e0d\u4f1a\r\n\r\n\u590d\u5236\u503c\uff08\u4ec5\u590d\u5236\u53e5\u67c4\uff09\u3002\u7ed3\u679c\uff0c\u4fee\u6539\u4ece\u53e6\u5916\u4e00\u4e2aTEXT\/BYTE\u53d8\u91cf\u8d4b\u503c\u7684TEXT\/BYTE\u53d8\u91cf\u5176\u5b9e\u4fee\u6539\u7684\u662f\u540c\u4e00\u4e2aLOB\r\n\r\n\u6570\u636e\u3002\u66f4\u6709\uff0c\u5206\u914d\u7ed9\u53d8\u91cf\u7684\u5b58\u50a8(\u6587\u4ef6\u6216\u5185\u5b58)\u53d8\u4e3a\u4e0d\u80fd\u5f15\u7528\u6216\u8005\u4e22\u5931\uff1a\r\n\r\nDEFINE b1, b2 BYTE \u2013 \u4e00\u6837\u7684\u6587\u672c\uff0c\u540c\u6837\u7684\u884c\u4e3a\r\nLOCATE b1 IN FILE \"mydata\" \u2013 \u76f4\u63a5\u5f15\u7528\u6587\u4ef6\r\nLOCATE b2 IN MEMORY \u2013 \u7528\u5185\u5b58\u4ee3\u66ff\u6587\u4ef6\r\nCALL b2.readFile(\"mydata\") \u2013\u8bfb\u6587\u4ef6\u5185\u5bb9\u5230\u5185\u5b58\r\n# FREE b2 \u2013 \u5728 LET\u4e4b\u524d\u91ca\u653e\u5185\u5b58\r\nLET b2 = b1 \u2013 b2\u548cb1\u4e00\u6837\u5f15\u7528\u6587\u4ef6\r\nINITIALIZE b1 TO NULL \u2013 \u88c1\u526a\u5f15\u7528\u7684\u6587\u4ef6\r\nDISPLAY IIF( b2 IS NULL, \"b2 is null\", \"b2 is not null\")\r\n-- \u663e\u793ab2 is null\r\n\r\n\u5728\u4e0b\u9762(\u65e0\u6548)\u4ee3\u7801\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u8bd5\u7740\u5b58\u50a8img BYTE \u53d8\u91cf\u503c\u5230\u4e34\u65f6\u53d8\u91cf\uff08tmp\uff09\u4e2d\u3002\u5178\u578b\u7684\u7f16\u7a0b\u6a21\u5f0f\u662f\u5728\u4fee\u6539\u524d\r\n\r\n\u5b58\u50a8\u65e7\u503c\u3002\u5b9e\u9645\u4f7f\u7528LET tmp=img \u8d4b\u503c\u4e0d\u4f1a\u50cf\u7b80\u5355\u6570\u636e\u7c7b\u578b(STRING,VARCHAR,DECIMAL)\u4e00\u6837\u590d\u5236LOB\u6570\u636e\uff0c\r\n\r\n\u53ea\u662f\u6570\u636e\u5f15\u7528(\u6bd4\u5982\u53e5\u67c4)\u4f1a\u88ab\u590d\u5236\uff1a\r\n\r\n-- \u63d0\u793a: \u8fd9\u662f\u4e2a\u65e0\u6548\u7684\u4ee3\u7801\u793a\u4f8b \r\nDEFINE img, tmp BYTE\r\nLOCATE img IN MEMORY\r\nCALL img.readFile(\"picture1.png\")\r\nLOCATE tmp IN MEMORY\r\nLET tmp = img \u2013 \u548c\u5b58\u50a8\u76ee\u524d\u7684\u6570\u636e\u4e0d\u540c\uff0c\u73b0\u5728\u4e24\u4e2a\u53d8\u91cf\u5f15\u7528\u540c\u4e00\u4efd\u6570\u636e\r\n\r\nCALLimg.readFile(\"picture2.png\")\r\nLET img = tmp \u2013 \u6ca1\u6709\u91cd\u65b0\u5b58\u50a8\u65e7\u6570\u636e\uff1a\u4ecd\u662f\u540c\u4e00\u4efd\u6570\u636e\r\n\r\n\u5982\u679c\u9700\u8981\u590d\u5236\u5927\u5bf9\u8c61\uff0c\u4f7f\u7528writeFile()\/readFile()\u65b9\u6cd5\u3002<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>BOOLEAN<\/p>\n<p>BOOLEAN \u6570\u636e\u7c7b\u578b\u5b58\u50a8\u903b\u8f91\u503c,TRUE\u6216FALSE\u3002<\/p>\n<p>\u8bed\u6cd5\u00a0BOOLEAN<\/p>\n<p>\u7528\u6cd5<\/p>\n<p>\u5e03\u5c14\u6570\u636e\u7c7b\u578b\u6709\u4e24\u4e2a\u53ef\u80fd\u7684\u503c\uff1aTRUE(\u6574\u65701)\u548cFALSE(\u6574\u65700)\u3002<\/p>\n<p>\u8fd9\u4e2a\u6570\u636e\u7c7b\u578b\u7684\u53d8\u91cf\u53ef\u4ee5\u7528\u6765\u4fdd\u5b58\u5e03\u5c14\u8868\u8fbe\u5f0f\u7684\u7ed3\u679c\uff1a<\/p>\n<p>DEFINE result BOOLEAN<br \/>\nLET result = ( length(&#8220;abcdef&#8221;) &gt; 0 )<\/p>\n<p>\u5e03\u5c14\u53d8\u91cf\u5178\u578b\u7684\u7528\u6cd5\u5c31\u662f\u4fdd\u5b58\u5e03\u5c14\u8868\u8fbe\u5f0f\u7684\u7ed3\u679c\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">FUNCTION checkOrderStatus( cid)\r\nDEFINE oid INT, b BOOLEAN\r\nLET b = ( isValid(oid) AND isStored(oid) )\r\nIF NOT b THEN\r\nERROR \"The order is not ready.\"\r\nEND IF\r\nEND FUNCTION<\/code><\/pre>\n<p>\u6ce8\u610f\u6570\u636e\u5e93\u4f9b\u5e94\u5546\u5b9e\u73b0\u7684SQL\u5e03\u5c14\u7c7b\u578b\u548cBDL BOOLEAN\u7c7b\u578b\u5e76\u4e0d\u5b8c\u5168\u4e00\u81f4\u3002\u6bd4\u5982\uff0cIBM Informix SQL \u5e03\u5c14\u7c7b\u578b<\/p>\n<p>\u63a5\u53d7\u2019t\u2019 \u548c \u2018f\u2019\u503c\uff0c\u800cBDL\u5e03\u5c14\u7c7b\u578b\u4ec5\u53ef\u4ee5\u63a5\u53d70\/FALSE \u548c1\/TRUE \u6574\u5f62\u503c\u3002 \u4f60\u53ef\u4ee5\u5728SQL\u8bed\u53e5\u4e2d\u4f7f\u7528\u5e03\u5c14\u7c7b\u578b\u53d8\u91cf\uff1a<\/p>\n<p>IBM Informix \u6216\u5176\u4ed6\u6570\u636e\u5e93\u9a71\u52a8\u5c06\u4f1a\u8d1f\u8d23\u8f6c\u6362\u3002\u540c\u6837\u6ce8\u610fTRUE\/FALSE\u5e38\u91cf\u53ea\u662fBDL\u8bed\u8a00\u5e38\u91cf\uff1a\u6570\u636e\u5e93SQL\u8bed\u6cd5<\/p>\n<p>\u53ef\u80fd\u4e0d\u652f\u6301\u8fd9\u4e9b\u5173\u952e\u5b57\uff0c\u6bd4\u5982INSERT INTO mytable(key,bcol) VALUES (455,TRUE)\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>CHAR(size)<\/p>\n<p>CHAR\u6570\u636e\u7c7b\u578b\u662f\u56fa\u5b9a\u957f\u5ea6\u7684\u5b57\u7b26\u4e32\u6570\u636e\u7c7b\u578b\u3002<\/p>\n<p>\u8bed\u6cd5CHAR[ACTER] [ (<em>size<\/em>)]<\/p>\n<p>1\u3001size\u5b9a\u4e49\u5b57\u7b26\u4e32\u7684\u6700\u5927\u5b57\u8282\u6216\u8005\u5b57\u7b26\u5355\u4f4d\uff08\u4f9d\u8d56\u4e8e\u8bed\u6cd5\u5b57\u7b26\u957f\u5ea6\uff09\u957f\u5ea6\u3002<\/p>\n<p>2\u3001\u4e00\u4e2a\u5b57\u7b26\u7c7b\u578b\u7684\u6700\u5927\u957f\u5ea6\u662f65534<\/p>\n<p>3\u3001\u5982\u679csize\u6ca1\u6709\u7279\u522b\u5b9a\u4e49\uff0c\u5b83\u7684\u9ed8\u8ba4\u957f\u5ea6\u662f1.<\/p>\n<p>\u7528\u6cd5<\/p>\n<p>\u5b57\u7b26\u7c7b\u578b\u5178\u578b\u7684\u7528\u6cd5\u662f\u4fdd\u5b58\u56fa\u5b9a\u957f\u5ea6\u7684\u5b57\u7b26\u4e32\u6bd4\u5982\u77ed\u7f16\u7801(XB124),\u7535\u8bdd\u53f7\u7801\uff08650-23-2345\uff09\uff0c\u6c7d\u8f66\u53f7\u7801\u3002<\/p>\n<p>CHAR\u548c CHARACTER \u662f\u76f8\u540c\u7684\u8bed\u6cd5\u3002<\/p>\n<p>CHAR\u53d8\u91cf\u5728\u51fd\u6570\uff0c\u6a21\u5757\u548c\u5168\u5c40\u53d8\u91cf\u4e2d\u53ef\u4ee5\u88ab\u521d\u59cb\u5316\u4e3aNULL\u3002<\/p>\n<p>\u6587\u672c\u5e38\u91cf\u53ef\u4ee5\u8d4b\u7ed9\u5b57\u7b26\u4e32\u53d8\u91cf\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">MAIN\r\nDEFINE c CHAR(10)\r\nLET c = \"abcdef\"\r\nEND MAIN<\/code><\/pre>\n<p>\u5f53\u8d4b\u503c\u662f\u975eNULL\u503c\u65f6\uff0c\u5b57\u7b26\u53d8\u91cf\u603b\u662f\u7528\u7a7a\u683c\u586b\u5145\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">MAIN\r\nDEFINE c CHAR(10)\r\nLET c = \"abcdef\"\r\nDISPLAY \"[\", c ,\"]\" \u2013 \u8f93\u51fa [abcdef \u00a0\u00a0\u00a0\u00a0]\r\nEND MAIN<\/code><\/pre>\n<p>\u5728\u6bd4\u8f83\u7b97\u5f0f\u4e2d\uff0c\u5b57\u7b26\u4e32\u672b\u5c3e\u7684\u7a7a\u683c\u662f\u6ca1\u6709\u610f\u4e49\u7684\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">MAIN\r\nDEFINE c CHAR(5)\r\nLET c = \"abc\"\r\nIF c == \"abc\" THEN -- \u503c\u4e3aTRUE\r\nDISPLAY \"equals\"\r\nEND IF\r\nEND MAIN<\/code><\/pre>\n<p>\u6570\u5b57\u548c\u65e5\u671f-\u65f6\u95f4\u503c\u53ef\u4ee5\u76f4\u63a5\u8d4b\u7ed9\u5b57\u7b26\u4e32\u53d8\u91cf\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">MAIN\r\nDEFINE c CHAR(50), da DATE, dec DECIMAL(10,2)\r\nLET da = TODAY\r\nLET dec = 345.12\r\nLET c = da, \" : \", dec\r\nEND MAIN<\/code><\/pre>\n<p>\u5f53\u628a\u5b57\u7b26\u7c7b\u578b\u7684\u53d8\u91cf\u63d2\u5165\u5230\u6570\u636e\u5e93\u5b57\u7b26\u7c7b\u578b\u7684\u5b57\u6bb5\u65f6\uff0c\u5b57\u6bb5\u503c\u4f1a\u88ab\u7528\u7a7a\u683c\u586b\u5145\u5230\u5b57\u6bb5\u957f\u5ea6\u3002\u540c\u6837\u7684\uff0c\u5f53\u4ece\u6570\u636e\u5e93\u5b57<\/p>\n<p>\u6bb5\u680f\u4f4d\u83b7\u53d6\u503c\u5230\u5b57\u7b26\u53d8\u91cf\u65f6\uff0c\u7a0b\u5e8f\u53d8\u91cf\u4f1a\u7528\u7a7a\u683c\u586b\u5145\u5230\u53d8\u91cf\u957f\u5ea6\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"null\">MAIN\r\nDEFINE c CHAR(10)\r\nDATABASE test1\r\nCREATE TABLE table1 ( k INT, x CHAR(10) )\r\nLET c = \"abc\"\r\nINSERT INTO table1 VALUES ( 1, c )\r\nSELECT x INTO c FROM table1 WHERE k = 1\r\nDISPLAY \"[\", c ,\"]\" -- displays [abc\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0]\r\nEND MAIN<\/code><\/pre>\n<p>\u5728SQL\u8bed\u53e5\u4e2d\uff0cCHAR\u503c\u7684\u6bd4\u8f83\u8fd0\u7b97\u5728\u4e00\u4e2a\u6570\u636e\u5e93\u548c\u5176\u4ed6\u6570\u636e\u5e93\u662f\u4e0d\u540c\u7684\u3002\u7136\u800c\uff0c\u5927\u90e8\u5206\u6570\u636e\u5e93\u5f15\u64ce\u5728\u6bd4\u8f83CHAR\u503c\u65f6\uff0c<\/p>\n<p>\u5ffd\u7565\u672b\u5c3e\u7684\u7a7a\u683c\u3002<\/p>\n<\/div>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.hefeiyu.com\">\u8d6b\u975e\u57df<\/a> &raquo; <a href=\"https:\/\/www.hefeiyu.com\/?p=554\">BDL-FGL_BASE \u6570\u636e\u7c7b\u578b(1)<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u6570\u636e\u7c7b\u578b \u9009\u62e9\u6b63\u786e\u7684\u6570\u636e\u7c7b\u578b\u6709\u52a9\u4e8e\u8f93\u5165,\u5b58\u50a8\u548c\u663e\u793a\u6570\u636e. \u6570\u636e\u7c7b\u578b \u63cf\u8ff0 BIGINT \u00a08\u5b57\u8282\u6709\u7b26\u53f7\u6574\u5f62 BOOLEAN \u00a0\u5e03\u5c14\u7c7b\u578b BYTE \u00a0\u4e8c\u8fdb\u5236\u5927\u6570\u636e\uff08\u56fe\u7247\uff09 CHAR[(n)] \u00a0\u56fa\u5b9a\u957f\u5ea6\u7684\u5b57\u7b26\u4e32 DATE \u00a0\u7b80\u5355\u65e5\u5386\u65e5\u671f\u7c7b\u578b DATET [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[180,178,179],"class_list":["post-554","post","type-post","status-publish","format-standard","hentry","category-4gl","tag-180","tag-178","tag-179"],"_links":{"self":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=554"}],"version-history":[{"count":2,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/554\/revisions"}],"predecessor-version":[{"id":556,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/554\/revisions\/556"}],"wp:attachment":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}