Home » SQL & PL/SQL » SQL & PL/SQL » sql code asking for username and password when running a batch file
sql code asking for username and password when running a batch file [message #229665] Mon, 09 April 2007 10:08 Go to next message
mlgonsalv
Messages: 35
Registered: March 2005
Location: DC
Member
Greetings to all Gurus!
I have a batch file when runs calls an sql file and generates sql reports into user's local directory. Instead of hardcoding username/password@db_string in the batch script, how to ask for username and password each time when the batchfile is run? Any tips would be greatly appreciated.
Thanks much.
MG

--my batch file
sqlplus username/password@db_string @//apps/oraapps/myfile.sql
Re: sql code asking for username and password when running a batch file [message #229667 is a reply to message #229665] Mon, 09 April 2007 10:25 Go to previous messageGo to next message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use something like:
Accept username char prompt "username? "
Accept pws char prompt "password? " hide
Accept srv char prompt "service name? "
connect &username/&psw@&srv
...

Then
sqlplus /nolog @/apps/oraapps/myfile.sql

Regards
Michel
Re: sql code asking for username and password when running a batch file [message #229970 is a reply to message #229667] Tue, 10 April 2007 08:00 Go to previous message
mlgonsalv
Messages: 35
Registered: March 2005
Location: DC
Member
Wonderful!!
Thanks Michel.
Previous Topic: Create View Problem
Next Topic: trigger help
Goto Forum:
  


Current Time: Tue Dec 06 14:01:24 CST 2016

Total time taken to generate the page: 0.09940 seconds