Re: SQL*Plus custom prompt as user name?
Date: 10 Aug 1999 23:00:57 GMT
Message-ID: <19990810190057.10041.00000113_at_ng-xa1.aol.com>
>>>is there any way to show current user name in SQL*Plus prompt?
>>The following Login.sql script will give the username and database instance
>>as the sql prompt at login. For example if the username is SCOTT and the
>>instance is TEST then the prompt will become: scott test>
>>set termout off
>>set numwidth 9
>>set linesize 180
>>set pagesize 300
>>column sid new_value osid noprint
>>column usr new_value ousr noprint
>>select lower (substr (global_name, 1, (instr (global_name, '.') -1))) sid
>> from global_name ;
>>select lower (user) usr from dual ;
>>set termout on
>>set sqlprompt '&ousr &osid> '
>>Good Luck,
>>Karen
>
>
>Nice script but what if you use connect statement in sqlplus.
>Then the prompt is wrong and would be quite confusing.
>Is there any way to run automatically login.sql after connect
>statement in sqlplus?
>
>Rauno
>
The only way I found was a sleezy workaround - make a .SQL file called - you guessed it CONNECT.SQL and set it there. As long as you remember to connect via that instead of using the reall connect, you are OK.
Similarly, you can write a script that sets the prompt, and just run it to make sure, or if you forget etc.
Dan Hekimian-Williams Received on Wed Aug 11 1999 - 01:00:57 CEST