Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-06-2004, 10:53 AM   #1
LQ Newbie
Registered: Nov 2004
Posts: 9

Rep: Reputation: 0
Lightbulb update oracle table using shell script

I would like to know how to update a table in Oracle database, if a command in one shell script either successfully completes or it fails.(like Y if its success or N if its a failure)

While the command is running,I am able to view the log file created in the Unix machine.After the command is exexcuted,it has to update a column in Oracle database . How can I do this?

any ideas or solutions are welcome.
Old 12-06-2004, 02:42 PM   #2
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 36
try something like this:

exsql ()  {
     awk '{ if(NR == 1) {
        print STR
        print "set pagesize 80;"
        print "set linesize 240;"
        print $0} 
        END { print "COMMIT;" } ' UI=$UID PW=$PSWD | sqlplus -s
# run my command - returns 0 on success
if [ $? -eq 0 ]; then
   echo "UPDATE MYTABLE SET FLD1=$somevalue" | exsql
Most commands return 0 or 1 in Unix.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Way to update mysql table 200+ times at once macie Programming 7 04-13-2005 11:45 PM
write an update query in shell prompt to update the database in sqlserver suchi_s Programming 2 09-29-2004 07:27 AM
Unable to update kernel routing table TrashCanMan Linux - Wireless Networking 2 03-07-2004 04:03 AM
mySQL table update DropHit Linux - Software 5 02-04-2004 10:47 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration