When you connect to sqlplus, you see the the following sql prompt. SQL>
By using this sql in the glogin.sql, you will see a prompt similar to the following:
SCOTT@DB-01>
Code:
The following code works on Oracle 8i (8.1.5, 8.1.6, 8.1.7).
You have to insert the following line of code in glogin.sql which is usually found in $ORACLE_HOME/sqlplus/admin
set termout off
set echo off
define X=NotConnected
define Y=DBNAME
Column Usr New_Value X
Column DBName New_Value Y
Select SYS_CONTEXT('USERENV','SESSION_USER') Usr From Dual;
--- The following does not work in 8.1.5 but works --- in 8.1.6 or above
Select SYS_CONTEXT('USERENV','DB_NAME') DBNAME From Dual;
--- If you are using 8.1.5, use this .
Select Global_Name DBNAME from Global_Name;
set termout on
set sqlprompt '&X@&Y> '
Please note that this method will work only when you make a new sql plus session because when you make a new sql plus session, then only glogin.sql is executed.
Welcome to the GEEK world, best place where you find topic about latest cutting edge technology on website and mobile. Learn and grow your knowledge with the information and tutorials about Website designing, CSS tutorials, Java Script tutorials, Ruby tutorials, ROR tutorials, HTML tutorials, HTML5 , JQuery, Javascript tutorials, Photoshop tutorials, Flash, games tutorials, Cheat sheets, Design tools, Action Scripts as well as MySql, Oracle and many more in a easy way to use and understand.
No comments:
Post a Comment