The following entries in either of these files sets the prompt to "user@database>"
define gname = 'not connected'
column global_name new_value gname
set termout off
select lower(user) || '@' || replace(global_name,'.WORLD',null) global_name
from global_name;
set termout on
set sqlprompt '&&gname> '
However, this is only run ONCE (when you login), so if you're the kind of person that issues "conn" or "connect" from within your SQL Plus session, you can then create two files
conn.sql
-----------
connect &1
@login
connect.sql
-----------
connect &1
@login
which will change your connection and then re-issue the prompt setting commands
scott@demo> @conn newuser/newpass
Connected.
newuser@demo>
我喜欢用这个
define gname = 'not connected'
column global_name new_value gname
set termout off
select lower(user) || '@' || utl_inaddr.get_host_address() || '@' || replace(global_name,'.WORLD',null) global_name
from global_name;
set termout on
set sqlprompt '&&gname> '
tong@19.200.1.33@OA>[@more@]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12482/viewspace-969039/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12482/viewspace-969039/
本文介绍如何在 SQL Plus 中自定义 SQL 提示符,包括使用 SQLPlus 的登录脚本设置提示符的方法,并通过示例展示了如何根据当前连接的数据库动态更新提示符。
1188

被折叠的 条评论
为什么被折叠?



