注:''''为四个单引号
[db2inst1@test ~]$ db2 "select ''''||current date||'''' from sysibm.sysdummy1"
1
-------------
'08/03/2016'
1 record(s) selected.
[db2inst1@test ~]$ db2 "select '.'''||current date||''',' from sysibm.sysdummy1"
1
--------------
.'08/03/2016',
1 record(s) selected.
You have mail in /var/spool/mail/db2inst1
[db2inst1@test ~]$
2016年11月10日 15:08 周四 农历 丙申 猴年 十月十一
db2 connect to sample
db2 -x "select 'select '''||trim(tabschema)||'.'||trim(tabname)||''' as tabname,count_big(*) as count from '|| trim(tabschema)||'.'||trim(tabname)||';' from syscat.tables
fetch first 1 row only" > /tmp/1.sql
db2 -tvf /tmp/1.sql
[db2inst1@test ~]$ db2 "select ''''||current date||'''' from sysibm.sysdummy1"
1
-------------
'08/03/2016'
1 record(s) selected.
[db2inst1@test ~]$ db2 "select '.'''||current date||''',' from sysibm.sysdummy1"
1
--------------
.'08/03/2016',
1 record(s) selected.
You have mail in /var/spool/mail/db2inst1
[db2inst1@test ~]$
2016年11月10日 15:08 周四 农历 丙申 猴年 十月十一
db2 connect to sample
db2 -x "select 'select '''||trim(tabschema)||'.'||trim(tabname)||''' as tabname,count_big(*) as count from '|| trim(tabschema)||'.'||trim(tabname)||';' from syscat.tables
fetch first 1 row only" > /tmp/1.sql
db2 -tvf /tmp/1.sql
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26224914/viewspace-2122930/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26224914/viewspace-2122930/