?
Solved

ksh script and db2 problem

Posted on 2004-11-23
3
Medium Priority
?
954 Views
Last Modified: 2012-08-14
Hi everyone
i am using ksh scripts and db2. i need to check in my database if a particular user exists,

echo "PLEASE ENTER THE EMPLOYEE NUMBER"
read enumm
echo "PLEASE ENTER THE MANAGER USER ID"
read uid
echo "PLEASE ENTER THE MANAGER PASSWORD"
read pswd
. db2init
QYE=`db2 -x "select count(*) from manUser where EMPLOYEE#=$enumm and USERID='$uid' and PASSWORD='$pswd'"`
echo "$QYE"
if [[ $QYE = 1 ]]
then
echo "existssss"
else
echo "doesn't exist"
fi

the output is
PLEASE ENTER THE EMPLOYEE NUMBER
1
PLEASE ENTER THE MANAGER USER ID
Admin
PLEASE ENTER THE MANAGER PASSWORD
510y
          1
"Doesn't exist!!!"

whereas the employee number 1 and user id Admin and password 510y does exist!.

Can someone please tell me where am i doing wrong?
Thanks
0
Comment
Question by:aik_21
2 Comments
 

Author Comment

by:aik_21
ID: 12661173
hey all,
actually i got the answer! for integer variables in comparison i have to use quotes, so it would be "$QYE"
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 13130416
PAQed with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question