Try this:
sqlplus oasis/prod123 @verify.sql $login $passwd
and in SQL script refer to these parameters using &1 and &2.
Let me know if it works.
Thanks and Best Regards,
Avneesh Kumar Rathor
"hma " <oracledba-ezmlmshield-x90540187.[Email address protected]
29 July 2006 18:25 ZE5B
To
"LazyDBA Discussion" <[Email address protected]
cc
Subject
Passing Shell variables to SQLPLUS for execution
Hi.. This is Jimy and I am new to the subject.Request your help on
resolving the issue on hand.
I have a unix shell script thru which a user enters UserId and Passwd.The
same data that of the USER and PASSWD needs to send to SQL for exection
and retriving a possible valid response.
Hope you revert back.
PASS >cat EnterPass.sh
#! /bin/csh -f
clear
printf "\n\n \n\n #####################################\n\n\n "
printf "\n\t\t\tEnter your Login ID : \t"
set LOGINID = $<
printf "\n\n\t\t\tEnter your Password : \t"
stty -echo
set PASSWD = $<
stty echo
printf " \n\n\n\n #####################################\n\n \n "
echo "Login ID = $LOGINID "
echo "PassWord = $PASSWD "
set login=$LOGINID
set pass=$PASSWD
echo $login
echo $pass
sqlplus oasis/prod123 @verify.sql
Note: pass the values stored in the variables $login and $pass to SQL to
Execution.
please tell me how can the values be dynamicaly passed.
I tried different options but i am not able to get thru , request you to
look into it.
======================================================================
File 2.Verify.sql
accept uid char prompt 'Enter Login ID : '
accept pwd char prompt 'Enter Password : '
select * from userpass where
login ='&uid' and trim(pass) =
translate('&pwd','abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()','1234567890!@#$%^&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ');
exit;
On manual entry I am getting the records., i also want to get a result
variable so.. that i can prompt a suitable response back to the user..that
the login was successfull and vice versa.
------------------------------------------------------------------------
This e-mail contains confidential and/or privileged information.If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure, use or distribution of the material in this e-mail
is strictly forbidden.
------------------------------------------------------------------------
--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these terms:
http://www.lazydba.com/legal.html
Whilst this email has been checked for all known viruses, recipients should undertake their own virus checking as Xansa will not accept any liability whatsoever.
This email and any files transmitted with it are confidential and protected by client privilege. It is solely for the use of the intended recipient.
Please delete it and notify the sender if you have received it in
error. Unauthorised use is prohibited.
Any opinions expressed in this email are those of the individual and not
necessarily the organisation.
Xansa, Registered Office: 420 Thames Valley Park Drive,
Thames Valley Park, Reading, RG6 1PU, UK.
Registered in England No.1000954.
t +44 (0)8702 416181
w www.xansa.com
Oracle LazyDBA home page