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: Enhancement SQL*Plus (prev.: Re: Fixing a little problem in the login.sql script found in Tom Kyte's book)

Re: Enhancement SQL*Plus (prev.: Re: Fixing a little problem in the login.sql script found in Tom Kyte's book)

From: Alison Holloway <Xalison.holloway_at_oracle.comX>
Date: Thu, 16 Jan 2003 11:59:51 +1100
Message-ID: <3E260407.2010704@oracle.comX>


Chris Jones will no doubt have some comments on this, but I thought I'd mention that in SQL*Plus 9.2, we introduced a define variable that contains the SID supplied by the user. This variable can be used to set the prompt. Here's the blurb from the 9.2 doc:

_CONNECT_IDENTIFIER DEFINE Variable

There is a new DEFINE variable _CONNECT_IDENTIFIER, which contains the SID as supplied by the user to make a connection where it is available. This allows the connection information to be accessed like any other DEFINE variable. For example, it could be used in TTITLE, in '&' substitution variables, or as your SQL*Plus command-line prompt by using the SET SQLPROMPT command. For example, to change your SQL*Plus prompt to display your username and SID, enter:

SET SQLPROMPT '&_CONNECT_IDENTIFIER > ' You can use the DEFINE command to view the _CONNECT_IDENTIFIER definition in the same way as you view other DEFINE definitions, using the DEFINE command with no arguments, or with the specific argument you wish to display, for example:

DEFINE or

DEFINE _CONNECT_IDENTIFIER You can use UNDEFINE to remove the _CONNECT_IDENTIFIER definition and make it unavailable.

In 10i, we're adding a little more to this. There will be define variables for _DATE, _PRIVILEGE, and _USER. So you will be able to do:

SET SQLPROMPT '_USER'@'_CONNECT_IDENTIFIER > ' Alison

Peter van Rijn wrote:
> Wouldn't it be nice if SQL*plus itself would offer the functionality of
> customizing the SQL-prompt? Let's say with dynamically changed
> USER/DBNAME/SID. A bit like the $PWD in PS1 on Unix.
>
> Christopher Jones listening in perhaps? Could this be done 'some day'?
>
> Peter
Received on Wed Jan 15 2003 - 18:59:51 CST

Original text of this message

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