Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQLPLUS login
In article <7rlejq$e82$1_at_nnrp1.deja.com>,
grsnow_at_my-deja.com wrote:
> I AM asking because I need to run sqlplus from a Unix shell script.
If
> the login is wrong, I want sqlplus to terminate and not reprompt for a
> username/password. How do I do that?
By doing a test login to sqlplus first. e.g. A shell script like this.....
{
echo "Username: \c"; read user
echo "$user's password: \c"; stty -echo;read pass;stty echo;echo
} >/dev/tty
# test if username and password were valid, else exit
sqlplus -s <<EOF | grep 'ORA-01017' && exit 1
$user/$pass
EOF
# Username and password are valid run SQL commands
sqlplus -s <<EOF
$user/$pass
SELECT sysdate FROM dual;
EOF
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Tue Sep 14 1999 - 12:53:47 CDT
![]() |
![]() |