Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,the following sql call works in a shell returning the value I expect in a form that I expect after logging into sqlplus.
SELECT pck_crypto.decrypt(uss.ftp_password) FROM up_stream_systems uss WHERE LOWER(uss.ftp_user) = 'ftpbsmsl';
Putting it into the following script does not.#!/bin/bash
if [ $# != 1 ]
then
echo "'$0 $*' Invalid"
echo "USAGE: $0 parameter1";
exit 1
fitst_USER=$1
echo $tst_USER
PMC_PASSWORD=`sqlplus -s / << PMC
SET HEADING OFF
SELECT pck_crypto.decrypt(uss.ftp_password)
FROM up_stream_systems uss
WHERE LOWER(uss.ftp_user) = ${tst_USER}
EXIT
PMC`if [ ${PMC_PASSWORD} ]
then
echo $PMC_PASSWORD
else
echo "No rows returned from database"
fi
How can I preserve the single quotes around the value that sql needs to test against the column in the here doc?
tia,

Since bash recognizes the \ (backslash character) as an escape character this should work in any distribution that uses bash as the default command interpreter.
Ernie Registered Linux User 247790
ICQ 41060744

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |