Re: Modifying SQL*Plus Command Prompt on UNIX

From: Dave Harris <dharris_at_uk.oracle.com>
Date: 1995/07/25
Message-ID: <3v31fk$lku_at_inet-nntp-gw-1.us.oracle.com>#1/1


moricet_at_ix.netcom.com (Tom Morice) wrote:

>Does anyone have a method to modify the UNIX SQL*Plus command prompt
>which includes elements such as UNIX hostname and Oracle userid. For
>example, I would like to set the prompt to look like the following:
 

> userid_at_hostname:SQL>
 

>where userid is the account the user is logged in to Oracle with
>and hostname is dynamically set based on the host the user is
>running SQL*Plus on.
 

>What would the glogin.sql or login.sql statements be to accomplish
>this?
 

>Would appreciate any help. Thanks.

This should do the trick for you providing you have access to the dynamic performance table v$session:


col sdyn new_value dyn noprint
set term off
select username||'_at_'||machine||':SQL>' sdyn from v$session
where audsid=userenv('sessionid');
set term on

set sqlprompt &dyn
undefine dyn


Dave Harris,
Oracle HR Development Received on Tue Jul 25 1995 - 00:00:00 CEST

Original text of this message