The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #8 (permalink)  
Old 07-03-2009
Sumedha Sobti Sumedha Sobti is offline
Registered User
  
 

Join Date: Jul 2009
Location: India
Posts: 9
Hi,

Here's my simple code that may solve your problem.
Lets say you have a 'usr' table with 'user ID, user Name, status (Active(A) or Suspended (S))'
1. Connection to DB is established wrt DB name in the tnsnames entry
2. Select/update query will retrive/update the information from the table resp.


Code:
#!/bin/ksh
echo "Please enter the User Id of the USER whose status needs to be activated"
read usrId
sqlplus username/password@database_name <<ENDOFSQL
set head off;
set feedback off;
set lines 300;
select * from usr where usrid='$usrId';
update usr set status='A' where usrId='$usrId';
ENDOFSQL
echo " "
echo "User Activated :: `echo $usrId`"
echo " "
exit;
Regards,
Sumedha

Last edited by Sumedha Sobti; 10-06-2009 at 08:48 AM..