Use retrieved selected column into Windows cmd variable [message #173315] |
Sun, 21 May 2006 14:35 |
hvdtol
Messages: 12 Registered: April 2005
|
Junior Member |
|
|
Hello,
I need some help on the following.
I am working on a Windows command file that does the following:
- Start sqlplus, connect to a database to collect a password for a specific user
- Put this password into a variable
- Start sqlplus again (in the same cmd file) and connect with that user and the retrieved password.
I don't know how to code it in the cmd file.
Can i use a selected column as variable into a cmd file?
Something like this:
mycmd.cmd
---------
SET SQLPASSWORD=birdie
SET SQLFILE=D:\mysql.sql
SET SQLPLUS_OUTPUT=D:\mysql.log
sqlplus -s system@xe/%SQLPASSWORD% @%SQLFILE% > %SQLPLUS_OUTPUT%
After here i want to use the collected password in the next command
sqlplus -s jan@xe/%PASSWORD% (password should be retrieved from the sql beneath)
----------
mysql.sql
---------
select password from schema.pwd where user= 'JAN';
quit
Any help is appreciated.
Thanks in advance,
Harry
|
|
|