当前位置: 移动技术网 > IT编程>数据库>Oracle > [20190524]sqlplus 与输出&.txt

[20190524]sqlplus 与输出&.txt

2019年05月25日  | 移动技术网IT编程  | 我要评论

[20190524]sqlplus 与输出&.txt

--//在sqlplus下 &一般作为参数替换,如何要输出&,一般有几种情况。据说这个问题是asktom站点查看最多的问题。
--//链接:https://connor-mcdonald.com/2018/12/21/your-asktom-top-10-for-2018/

1.要求输出 &.
2.要调用外部命令放入后台执行,而bash shell的后台命令一般在命令后写入 &,这样正好存在冲突。

--//解决方法:
scott@test01p> @ ver1
port_string                    version        banner                                                                               con_id
------------------------------ -------------- -------------------------------------------------------------------------------- ----------
ibmpc/win_nt64-9.1.0           12.2.0.1.0     oracle database 12c enterprise edition release 12.2.0.1.0 - 64bit production              0

方法1:
--//临时关闭变量替换。
scott@test01p> set define off;
scott@test01p> select 'a &b ' from dual ;

'a&b'
----
a &b

方法2:
--//设置另外的字符代替&,例子:
scott@test01p> set define #
scott@test01p> select 'a &b ' from dual ;

'a&b'
-----
a &b

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网