Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: a database name as sql prompt
In article <Pine.SOL.3.91.970613093258.29243A-100000_at_biotec>,
Abiy Alemu <abiy_at_biotec.jouy.inra.fr> wrote:
>
> Has some one an idea as to how to have the database name as the sql
> prompt when connected to sql plus ?
>
> Thank you!
You could put the following code in your login.sql or glogin.sql file:
set embedded on
set heading off
set feedback off
column glob_name new_value glob noprint
select substr(global_name,1,instr(global_name,'.')-1)||'>' glob_name
from global_name;
set sqlprompt '&glob '
column glob_name clear
set embedded off
set heading on
set feedback on
This truncates the ".WORLD" that may be in the global_name view.
You can also retrieve the database name from the v$database view, but we had some problems with that because some users do not have access that view.
Hope this helps.
John Reimer
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Fri Jun 13 1997 - 00:00:00 CDT