Re: SQL*Plus custom prompt as user name?

From: Rauno Seppanen <>
Date: Tue, 10 Aug 1999 17:12:13 GMT
Message-ID: <N3Zr3.371$>

>>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,

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 Received on Tue Aug 10 1999 - 19:12:13 CEST

Original text of this message