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: Rajesh Dayal <Rajesh_at_ohitelecom.com>
Date: Tue, 18 Feb 2003 01:09:07 -0800
Message-ID: <F001.0054FE78.20030218010907@fatcity.com>


Sorry, I missed your question earlier (too busy to check all the mails everyday)..  

            In the last line of my last mail I had mentioned that 

>>>
Alternatively you can create a file with above lines, put that file in bin and call it anytime to make your prompt... <<< So you can create a file say con1.sql (in your bin directory) with following content >>>>>>>>

ACCEPT USER CHAR PROMPT 'User: '
ACCEPT PSWD CHAR PROMPT 'Password: ' HIDE ACCEPT DBNAME CHAR PROMPT 'Database: '
CONNECT &USER@&DBNAME/&PSWD
set heading off
set term off
set feedback off
spool myprompt.lst
select 'set sqlprompt "' || SYS_CONTEXT ('USERENV', 'session_user') || '@' || SYS_CONTEXT ('USERENV', 'DB_NAME') || '>"' from dual
/
spool off
@myprompt.lst
set heading on
set term on
set feedback on
              <<<<<<<<<<<<<<
     

    While reconnecting from existing sql session you can call con1.sql and have your prompt set.  

Cheers,
Rajesh  

mm...
what if i logged in with SYSTEM first then "conn sys/pswd_at_db"? it's still show SYSTEM @db.
----- Original Message -----
To: Multiple recipients of list ORACLE-L <mailto:ORACLE-L_at_fatcity.com> Sent: Saturday, February 15, 2003 6:53 PM You can add following lines to your glogin.sql ($ORACLE_HOME/sqlplus/admin directory) file.   

set heading off
set term off
set feedback off
spool myprompt.sql
select 'set sqlprompt "' || SYS_CONTEXT ('USERENV', 'session_user') || '@' || SYS_CONTEXT ('USERENV', 'DB_NAME') || '>"' from dual
/
spool off
@myprompt.sql
set heading on
set term on
set feedback on   

Alternatively you can create a file with above lines, put that file in bin and call it anytime to make your prompt...   

Cheers,
Rajesh   

----Original Message-----
Aboali
Sent: Saturday, February 15, 2003 2:14 PM To: Multiple recipients of list ORACLE-L   

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



Senior Software Developer
Management Information Systems
http://www.mis-kuwait.com
Phone:
+965.240.64.25 
+965.240.67.98 
+965.240.80.92 

Ext. 235
Fax. +965.240.81.53
Cell. +965.790.31.65  
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Rajesh Dayal
  INET: Rajesh_at_ohitelecom.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 Tue Feb 18 2003 - 03:09:07 CST

Original text of this message

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