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

Home -> Community -> Usenet -> c.d.o.tools -> Re: instance name in SQL Plus prompt?

Re: instance name in SQL Plus prompt?

From: Kay Kanekowski <kkanekowski_at_a-m-c.de>
Date: Fri, 25 May 2001 10:59:34 +0200
Message-ID: <9el6qn$4d7$1@fermi.tro.net>

Hi Dan,

try this :

SET FEEDBACK OFF
SET TERMOUT OFF
SET HEADING OFF COL user_name NEW_VALUE mc_user_name
COL db_name NEW_VALUE mc_db_name

SELECT LOWER ( user ) user_name,

       LOWER ( SUBSTR( global_name,1,(INSTR(global_name,'.',1,1)-1))) db_name
  FROM global_name;

SET SQLPROMPT '< &mc_user_name:&mc_db_name > '

SET TERMOUT ON
SET FEEDBACK ON
SET HEADING ON Put in your login.sql or write to another script which is called by the login.sql.
Every time you the SQL*Plus the login is running. But the login.sql is not called if do 'connect scott/tiger' or others connect in a SQL*Plus session. The login.sql is NOT called and the prompt is not changed, so after a connect you have to call the script above or you write a little script that do the connect and then calls the login.sql

HTH
Kay

Daniel A. Morgan <dmorgan_at_exesolutions.com> schrieb in im Newsbeitrag:
3B0DFC51.615A694F_at_exesolutions.com...

> "Dan A." wrote:
>
> > Hi - Does anyone know how to put the current instance name in the sql
 plus
> > prompt? I'm using the windows (2000) version of sqlplus. Instead of
 the
> > default:
> >
> > SQL>
> >
> > can it be changed to something like:
> >
> > TESTDB>
> >
> > and it would always change to whatever instance you login to?
> >
> > Thanks in advance! -Dan
>
> No.
>
> Daniel A. Morgan
>
Received on Fri May 25 2001 - 03:59:34 CDT

Original text of this message

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