Hi All,
I need to write one shell script. The requirement is as follows.
a) I am having list the employee names in a file stored in /tmp directory location as below
/tmp/emp.txt
b) and the contents are as below
cat emp.txt
ravi
raj
ram
arun
c) I need to connect to sybase database (assume the name of the database is textbt)
d) Then i need to execute the following select query in that database
select status, emp_name from emp where emp_name in (<these names will have to come from that unix file /tmp/emp.txt)
i mean the where clause will have to contain like this
where emp_name in ('ravi','raj','ram','arun')
e) If the status value is "A" (active), only then it will have to be updated as "I" (In active) for the respective emp names.
i.e) One update query will also have to be generated dynamically and executed as below.
assume, the status is "A" for only the emp names ravi and ram
then the update query should be like the below
update emp set status = 'I' where emp_name in ('ravi','ram')
Please could you help me in providing some ideas. Thanks in advance.