Home » RDBMS Server » Server Administration » Re: Setting the SQL Prompt to show up the host name
Re: Setting the SQL Prompt to show up the host name [message #373041] Fri, 23 March 2001 12:31 Go to next message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
Put this in your login.sql
set termout off pause off arraysize 1
rem
rem Store username
rem
col user_id new_value user_id
col user_name new_value user_name
select user_id, lower(username) user_name from user_users
where username = user;
rem
rem Store database name
rem
col db_name new_value db_name
select lower(substr(global_name,1,(instr(global_name,'.',1,1)-1)))
db_name from global_name;
set sqlprompt "&db_name:&user_name> "

Obviously when you change to a different server with "connect..." during a session, your prompt wont change.
Re: Setting the SQL Prompt to show up the host name [message #373045 is a reply to message #373041] Fri, 23 March 2001 13:05 Go to previous messageGo to next message
Roy George
Messages: 7
Registered: March 2001
Junior Member
Thanks Andrew... It is working.

Is there anyway to change it while using 'connect...' from the SQL Prompt.
Re: Setting the SQL Prompt to show up the host name [message #373048 is a reply to message #373041] Fri, 23 March 2001 14:08 Go to previous messageGo to next message
Raj
Messages: 411
Registered: November 1998
Senior Member
Where can i find login.sql
Re: Setting the SQL Prompt to show up the host name [message #373050 is a reply to message #373041] Fri, 23 March 2001 14:36 Go to previous messageGo to next message
Bobby
Messages: 32
Registered: August 2000
Member
Try this script..

set termout off pause off arraysize 1
rem
rem Store username
rem
col user_id new_value user_id
col user_name new_value NULL
col user_name new_value user_name

select user_id, lower(username) user_name from user_users
where username = user;
rem
rem Store database name
rem
col db_name new_value NULL
col db_name new_value db_name
select substr(global_name,1,20)
db_name from global_name;
set sqlprompt "SQL> "
set sqlprompt "&db_name:&user_name> "

Let me if it worked.
Re: Setting the SQL Prompt to show up the host name [message #373051 is a reply to message #373041] Fri, 23 March 2001 14:43 Go to previous messageGo to next message
Roy George
Messages: 7
Registered: March 2001
Junior Member
This is in your plus80 directory. It is Glogin.sql too.
Re: Setting the SQL Prompt to show up the host name [message #373052 is a reply to message #373041] Fri, 23 March 2001 14:49 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
> Is there anyway to change it while using 'connect...' from the SQL Prompt
Not as far as I know.
Previous Topic: OCP questions / Study circle
Next Topic: SQLPLUS/SQLLOader error handling/return codes
Goto Forum:
  


Current Time: Mon Dec 23 05:34:07 CST 2024