Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: a database name as sql prompt

Re: a database name as sql prompt

From: <jjreimer_at_wthg.com>
Date: 1997/06/13
Message-ID: <866214286.32343@dejanews.com>#1/1

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 Usenet
Received on Fri Jun 13 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US