Is there a way to update the user id in the SQL prompt dynamically ?

Is there a way to update the user id in the SQL prompt dynamically ?

 

  

Please help if you can .... Thank You in advance.

I have the following code in my login.sql

undefine myusrid mydbname
col myusrid new_value myusrid
col mydbname new_value mydbname
set termout off
select lower(user) myusrid,
global_name mydbname
from global_name
/
set termout on
set sqlprompt '&&myusrid.@&_CONNECT_IDENTIFIER> '

and it does work fine.
after login my prompt is:
[Email Address Removed] Now; I want to change to a different user:
[Email Address Removed] connect system/mysystempswd
Connected.
[Email Address Removed] show user
USER is "SYSTEM"
[Email Address Removed] What I am looking for is how to change the prompt so that the new user is displayed as part of the prompt: [Email Address Removed] Jose.



Oracle LazyDBA home page