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
Updating table on UNIX server using SFTP Pallavi_gondkar UNIX for Dummies Questions & Answers 1 04-04-2008 02:47 AM
First Script: Query every table with column xxx. Iniquity Shell Programming and Scripting 1 02-06-2007 01:15 PM
Store return code of shell script in oracle table sveera Shell Programming and Scripting 3 05-04-2005 10:25 AM
updating a column in a unix table for a particular row thanuman Shell Programming and Scripting 4 04-26-2005 04:59 AM
update a oracle table using shell script ann_124 Shell Programming and Scripting 2 12-18-2004 04:24 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-09-2005
Registered User
 

Join Date: Mar 2005
Location: INDIA
Posts: 60
Red face updating a column in oracle table using shell script

Hi friends,
i am having a variable declared in .profile.i am changing its value in a shell script and then i am connecting to oracle and then from there i am calling a .sql called update.sql
STATUS is the variable declared in the .profile
===============================
if [ $STATUS -eq 1 ]
sqlplus <<END
username/password@connectstring
@update.sql
commit;
but how to i pass the value of the $STATUS to the .sql ? this value has to go into a column in a table.
Please help
thanks in advance
Veera
Reply With Quote
Forum Sponsor
  #2  
Old 05-09-2005
Registered User
 

Join Date: Aug 2001
Posts: 179
You can specify STATUS value as &1 in update.sql file and call the script as
@update.sql $STATUS
or
@update.sql 1 as the script is called only if STATUS is equal to 1
Reply With Quote
  #3  
Old 05-09-2005
Registered User
 

Join Date: Mar 2005
Location: INDIA
Posts: 60
Red face updating a column of a oracle table

Hi SSSROW,
Thanks for the reply but it doesnt help me. the update is not taking place.
it says zero rows updated.
Please help out.
thanks
Veera
Reply With Quote
  #4  
Old 05-09-2005
Registered User
 

Join Date: Jan 2005
Posts: 682
sssow's post should accomplish what you are requesting. Can you provide your update.sql script? It should look something like this:
Code:
-- update.sql
update yourtable 
set    status=&1
where  whatever='some key value';
And your usage of update.sql should look like this:
Code:
if [ $STATUS -eq 1 ]
sqlplus <<END
username/password@connectstring
@update.sql $STATUS
commit;
END
Thomas
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:25 AM.


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

Content Relevant URLs by vBSEO 3.2.0