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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: how to make sql prompt like USER@DATABASE> ?

Re: how to make sql prompt like USER@DATABASE> ?

From: <JayK_at_ibsplc.com>
Date: Mon, 17 Feb 2003 21:33:38 -0800
Message-ID: <F001.0054FD26.20030217213338@fatcity.com>


Dear Prem,

Include this in your Glogin.sql in \sqlplus\admin in 9i.

column user new_value A noprint
column check new_value b noprint
select user from dual;
select
substr(global_name,1,decode(instr(global_name,'.'),0,length(global_name), instr(global_name,'.')-1)) "check" from global_name; set sqlprompt &A@&B==>
cl scr
prompt "Hi......."

I have used the combination of decode,instr and substr to remove the trailing qualifiers,
if any, in the Global Database Name.

HTH. Best Regards
Jai

Prem Khanna J <jprem_at_kssnet.co.jp>
Sent by: root_at_fatcity.com
02/18/03 10:18 AM
Please respond to ORACLE-L  

        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
        cc: 
        Subject:        Re: how to make sql prompt like USER_at_DATABASE> ?


Salaheldin Aboali ,

add the feww lines below to your
$ORACLE_HOME/sqlplus/admin/glogin.sql



set term off
column prompter new_value m_prompt

select username || '@' || name || '>' prompter

                 from v$session,v$database;
 

set sqlp '&m_prompt'
undefine m_prompt

commit;
set term on


Note: this will affect all the users connecting to the DB.

HTH.
Jp.

> ----Original Message-----
> From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of
> Salaheldin Aboali
> Sent: Saturday, February 15, 2003 2:14 PM
> To: Multiple recipients of list ORACLE-L
> Subject: how to make sql prompt like USER_at_DATABASE> ?

> hi
> how to make sql prompt like USER_at_DATABASE> ?
> where USER: connected user
> DATABASE: database global name, or database local alias

> Regards,
> Salaheldin Aboali
 

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Prem Khanna J
  INET: jprem_at_kssnet.co.jp

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: 
  INET: JayK_at_ibsplc.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Feb 17 2003 - 23:33:38 CST

Original text of this message

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