routine Ramblings

Just another WordPress.com weblog

Customize SQL Plus prompt

Run this following code in SQL Plus to customize the sql prompt to the format username@datbase name.

So if you are the user vmk and the datbase name is acmedb they the prompt appears as,

vmk@acmedb >
 
So here it is

define gname=idle

column global_name new_value gname
 
select lower(user) || ‘@’ || substr( global_name,1,
decode( dot, 0, length(global_name), dot-1) ) global_name
from (select global_name, instr(global_name,’.’) dot from global_name );
 
set sqlprompt ‘&gname> ‘


Tags:

Advertisements

February 15, 2008 - Posted by | Uncategorized

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: