[20220105]sqlplus &1替换最大支持239个字符.txt
--//昨天遇到的问题,使用&3之类替换时,如果替换的字符串超过一定长度,语句会报错,做一个记录。
1.环境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
2.测试:
$ seq -f "%-1.0f" 1e9 90000011 1e10 | paste -sd',' >|aa.txt
$ cat t1.txt
select '&1' from dual ;
quit
$ rlsql -s -l scott/book @t1.txt 11111
'1111
-----
11111
$ rlsql -s -l scott/book @t1.txt $(cat aa.txt )
string beginning "1000000000..." is too long. maximum size is 239 characters.
$ echo $(cat aa.txt )
--//输出没问题。根据提示应该是替换的字符串超长了。最大239个字符。编辑aa.txt看看。
$ wc aa.txt
1 1 240 aa.txt
--//删除回车相当于239个字符。
$ rlsql -s -l scott/book @t1.txt $(cat aa.txt )
'1000000000,1090000011,1180000022,1270000033,1360000044,1450000055,1540000066,1630000077,1720000088,1810000099,1900000110,1990000121,2080000132,2170000143,2260000154,2350000165,2440000176,2530000187,
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1000000000,1090000011,1180000022,1270000033,1360000044,1450000055,1540000066,1630000077,1720000088,1810000099,1900000110,1990000121,2080000132,2170000143,2260000154,2350000165,2440000176,2530000187,2620000198,2710000209,2800000220,28900002
--//大家可以自行尝试增加1个字符就不行了。
--//不知道为什么sqlplus有这个限制。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2850688/ ,如需转载,请注明出处,否则将追究法律责任。