Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: What happens when I log on to SQLPlus
On Mon, 22 Apr 2002, RSH_Oracle_at_worldnet.att.net wrote:
> I'd be very hesitant to do SELECTs in the main glogin.sql file. But
> I'm NOT fond of extreme cleverness like:
>
> SYSTEM on P1_at_SUN1 on 5/1/2002 @ 5:45 >
>
> Prompts that take up half the screen are not among my favorite things.
> Besides, how hard is it to do a ! and ask the host what time and date
> it is, or, wear a watch maybe?
Use chr(10) in the select.
Not sure if anybody would find this useful, but I have a sqlprompt that looks like so:
[3542][44][83][gboyer_at_B4PD]
SQL>
The first line shows, [SPID][PID][SID][username/instance] The usefulness
should be readily apparent. The second line then just makes sure to
notify me that I'm not on shell command line, while giving me a large
amount of space to type SQL. I stole a start of this from somewhere and
then added my own flavor.
I quess the main thing is to use the chr(10) and then have two lines representing the prompt, with the second line as long as possible.
define gname = 'not connected'
set termout off
column pid new_value spid
select '[' || a.spid || '][' || a.pid || '][' || b.sid || ']' pid FROM v$process a, v$session b WHERE a.addr = b.paddr AND b.audsid = userenv('sessionid');
column global_name new_value gname
select '[' || lower(user) || '@' || replace(global_name,'.WORLD',null) || ']' || chr(10) || 'SQL> ' global_name
from global_name;
set termout on
set sqlprompt '&&spid&&gname'
I have to run another script, which I call conn.sql, which calls this script. Then, I just make sure that I always connect using the conn.sql script.
-- Galen deForest Boyer Sweet dreams and flying machines in pieces on the ground.Received on Mon Apr 22 2002 - 20:53:17 CDT
![]() |
![]() |