LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Shell Script: want to insert values in database when update script runs (http://www.linuxquestions.org/questions/programming-9/shell-script-want-to-insert-values-in-database-when-update-script-runs-594176/)

ring 10-24-2007 08:21 AM

Shell Script: want to insert values in database when update script runs
 
Hi ,

I am new to linux and also also to shell scripting.
I have one shell script which unpacks .tgz file and install software on machine.
When this script runs I want to insert id,filename,description(which will be in readme file),log(which will be in log file) and name of unpacked folder like: tmp/MyFile into "MyTable"(database).
I don't have any idea about how to read data from file and insert that data into database table. This is for description and log field. Datatype of these fields is CLOB. Even I want to find max(id) from exiting table data, so that I can insert mew entry as maxid+1.

I am facing problems while writing this script.
Could anybody help me with this?

Thanks in advance
Ring

Tinkster 10-25-2007 10:25 PM

Which database are you using, how do you interface with it from the
command-line?


Cheers,
Tink

ring 10-25-2007 11:48 PM

I am using oracle database.
used commands are like this :
VALUE=`sqlplus -silent ypsystem/yp <<END
set pagesize 0 feedback off verify off heading off echo off
select max(id) from releasenotes;
exit;
END`


All times are GMT -5. The time now is 03:24 PM.