The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script required to get a required info from file. Pls. help me. ntgobinath Shell Programming and Scripting 2 05-31-2008 05:34 AM
7028-6C4 with an attached 7311-D20 prichard AIX 3 05-05-2008 07:44 PM
sed script required jaganadh Shell Programming and Scripting 2 07-05-2007 11:54 PM
help required in unix command/script thaduka UNIX for Advanced & Expert Users 1 10-17-2005 11:27 PM
UNIX PATH info required PLEASE HELP (I'm new to unix) akitachi UNIX for Dummies Questions & Answers 1 05-10-2002 11:37 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Jan 2007
Posts: 4
Help Required: To run the attached UNIX script

Hi,

This Script contains update statements and running without error.
But the update result is not getting reflected in the database. i.e may be Script fails to connect to the database.

it would be of great help if you could figure out the problem.

Thanks,
Shruti

Script follows here:
///////////////////////
#!/usr/bin/ksh
echo "************************************************** ************************************************** ********";
echo Making a customer hold or Block
echo "************************************************** ************************************************** *******";

echo "Enter the product name, customer name and the functionality [HOLD(HD)/ BLOCK (BK)]:"
read prod_name;
read cust_name;
read block_hold;

echo $block_hold;

if [[ block_hold = "BK" ]]; then
echo "Block";
`sqlplus -s itm_odb/itm_odb<<EOF
update CUST_PROD_TBL set BLOCKED_STATUS = 'Y' where prod_id = (select prod_id from products_tbl where product_name ='$prod_name') and cust_id = (select cust_id from CUSTOMER_tbl where CUST_name ='$cust_name');

exit;
EOF
`
echo "Block update successfull";
fi

if [[ block_hold = "HD" ]];
then
echo "Hold";
`sqlplus -s itm_odb/itm_odb<<EOF
UPDATE customer_view SET site_id = 'XXX' WHERE site_id = '$cust_name';

exit;
EOF
`
echo "HOLD update successfull";
fi

exit;
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-08-2007
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,643
Change
Code:
if [[ block_hold = ".." ]]; then
to
Code:
if [[ "${block_hold}" = ".." ]]; then
Reply With Quote
  #3 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Code:
UPDATE customer_view SET site_id = 'XXX' WHERE site_id = "'"$cust_name"'";
Reply With Quote
  #4 (permalink)  
Old 01-08-2007
tayyabq8's Avatar
UNIX Hobbyist
 

Join Date: Nov 2004
Location: /World/Asia/MiddleEast/Kuwait/Salmiya
Posts: 513
Your if statement is having problem, try to modify your if statements as follows:
Code:
if [[ $block_hold = "BK" ]]; then
i.e. put a $ before variable name in if statement.
Reply With Quote
  #5 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Jan 2007
Posts: 4
Thanks a lot!

Thanks a lot!
this solves my problem!
Reply With Quote
  #6 (permalink)  
Old 01-08-2007
Registered User
 

Join Date: Jan 2007
Posts: 4
Thanks a lot!

Thanks a lot!
This solves my Problem
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0