Db2可以设置只执行SQL语句,不显示SQL语句的输出,这里要使用命令行的+o选项:
示例:
db2hadr@node01:~> db2 "select * from t1"
ID NAME
----------- ----------
100 aaa
200 ccc
2 record(s) selected.
db2hadr@node01:~> db2 +o "select * from t1" <-这里什么输出也没有
db2hadr@node01:~>
另外,如果是DB2交互模式下,也可以使用 update command options using o OFF来关闭,示例如下:
db2hadr@node01:~> db2...
For more detailed help, refer to the Online Reference Manual.
db2 => select * from t1
ID NAME
----------- ----------
100 aaa
200 ccc
2 record(s) selected.
db2 => update command options using o OFF
db2 => list command options
db2 => select * from t1
db2 => insert into t1 values(300,'eee')
db2 => update command options using o ON
DB20000I The UPDATE COMMAND OPTIONS command completed successfully.
db2 => select * from t1
ID NAME
----------- ----------
100 aaa
200 ccc
300 eee
3 record(s) selected.