Home » Other » Client Tools » SqlPrompt
SqlPrompt [message #291571] Sat, 05 January 2008 01:04 Go to next message
vishal_srivastava
Messages: 21
Registered: January 2008
Junior Member
hi all,
I want that particular schema name to be displayed when I login to that schema in place of sqlprompt.

i tried by saving the login.sql file in bin directiory.
(Oracle_home/bin)/login.sql

COLUMN global_name NEW_VALUE gname
SET TERMOUT OFF
SELECT INITCAP(USER) || '@' || INITCAP(global_name) global_name
FROM global_name;
SET TERMOUT ON
SET TIMING ON
SET SQLPROMPT '&gname> '
SET LINESIZE 120


On attempting the login.sql as discussed above,i am geting one problem.
If i am changing the schema ,then it is showing the same schema name on sql prompt by which i first login.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production

System@abc.Us.Oracle.Com>
System@abc.Us.Oracle.Com>
System@abc.Us.Oracle.Com> disc
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
System@abc.Us.Oracle.Com> conn scott
Enter password: *****
Connected.
System@abc.Us.Oracle.Com>


suggest some alteration in my script,or give your own.
Re: SqlPrompt [message #291576 is a reply to message #291571] Sat, 05 January 2008 01:34 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Create a connect.sql script that calls you login.sql and use this to connect instead of using the connect statement.
For instance:
Connect &1
@@login

Then use "@connect user/psw" instead of "connect user/psw"

Note that in 10g and up, login.sql is automatically executed when you use "connect" statement.

I suggest you to even create your "disconnect.sql" script to reset the prompt when you are no more connected:
Disconnect
Set SQLPROMPT "Not connected>"

And call "@disconnect" instead of "disconnect".

Regards
Michel

[Updated on: Sat, 05 January 2008 01:34]

Report message to a moderator

Previous Topic: SQL worksheet
Next Topic: How to add data with &
Goto Forum:
  


Current Time: Thu Mar 28 17:09:03 CDT 2024