To update a column in a table through shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To update a column in a table through shell script
# 1  
Old 06-28-2009
Java To update a column in a table through shell script

Hi All,

I need to write a shell script in UNIX that should accept booking number as an argument and update it with value "NULL" if the transaction date is greater than 2 years. Booking number and transaction_date are the two columns of the table table_booking.

Something like this, through shell script where booking_number would be the argument to the script:
update table_booking set booking_number=" " where transaction_date > 2 years.

Please help me out with this, me being very new to shell programming.

Thanks in advance.

Last edited by shilpa_acc; 06-28-2009 at 06:24 PM..
# 2  
Old 06-28-2009
Quote:
Originally Posted by shilpa_acc
...
Something like this, through shell script where booking_number would be the argument to the script:
update table_booking set booking_number=" " where transaction_date > 2 years.
...
Something doesn't compute here.
Since the booking_number column is anyway being set to null, what's the point of passing its value as the argument ?

Or have you provided only half the information ?

tyler_durden
# 3  
Old 06-28-2009
update on table :

If you want to update in table then any way you have to connect sql and run that command so better use PL/SQL query.
# 4  
Old 06-29-2009
update on table

I think you had given only half information.

"Something like this, through shell script where booking_number would be the argument to the script:
update table_booking set booking_number=" " where transaction_date > 2 years.
"

This query is going work independent of the value of input argument i.e booking number...

Please state the exact requirement
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to insert data into black column( Secound Column ) in excel (.XLSX) file using shell script?

Source Code of the original script is down below please run the script and try to solve this problem this is my data and I want it column wise 2019-03-20 13:00:00:000 2019-03-20 15:00:00:000 1 Operating System LAB 0 1 1 1 1 1 1 1 1 1 0 1 (5 Replies)
Discussion started by: Shubham1182
5 Replies

2. Shell Programming and Scripting

Need awk or Shell script to compare Column-1 of two different CSV files and print if column-1 matche

Example: I have files in below format file 1: zxc,133,joe@example.com cst,222,xyz@example1.com File 2 Contains: hxd hcd jws zxc cst File 1 has 50000 lines and file 2 has around 30000 lines : Expected Output has to be : hxd hcd jws (5 Replies)
Discussion started by: TestPractice
5 Replies

3. Shell Programming and Scripting

Update a mysql column via bash script

Hello, I want to check the value of all MySQL columns.(column name is "status") via bash script. If value is "0" at I want to make only single column value to "1" I have many "0" values on mysql database(on "status" column) "0" means it is a draft post. I want to publish a post. I... (2 Replies)
Discussion started by: tara123
2 Replies

4. Shell Programming and Scripting

Shell Script Table

Hi, i need a bit help. I must write a script with shell- and sed-commands, which reads a table from stdin and writes a html-table on stdout (so i can open it with a web browser). The number of columns must be a parameter for the script, so i can start it for example with: "./htmltab.sh 3... (3 Replies)
Discussion started by: scruffytramp
3 Replies

5. Shell Programming and Scripting

How to update a Oracle table through shell scripting?

My Code is get_week_date() { `sqlplus -s ${DQM_SQL_LOGON}@${DQM_SID} << EOF SET ECHO OFF SET FEEDBACK OFF SET PAGES 0 SET SERVEROUTPUT ON SET VERIFY OFF SET TRIMSPOOL ON (update file_level_qc fq set FQ.DATA_FILE_NAME='Hyvee_Pharmacy_Solutions_201304_v1.txt'... (2 Replies)
Discussion started by: karthick.cho
2 Replies

6. UNIX for Dummies Questions & Answers

How to Update DB table from txt file using CRONJOB in Unix Shell Script

Hi Experts, can guide how we can Update a Database Table using a txt file source Using Unix Shell Scripts. What are the Cron Jobs codes can written to Update DB table. txt file contains record like data. US 09/03/2012 User DocType DocID. these above feilds in txt files need to be updated in... (4 Replies)
Discussion started by: mahesh.sap
4 Replies

7. UNIX for Advanced & Expert Users

unix script for update or insert records from a file to a oracle table

Hi, I have delimited file(|). Sample data: 1|name|50009|DS24|0|12 2|name|30009|DS24|0|13 3|name|20409|DS24|0|14 4|name|20009|DS24|0|15 5|name|10009|DS24|0|16 I want to load this data into a oracle table (update and insert) Please help me the commands and also... (1 Reply)
Discussion started by: unihp1
1 Replies

8. Shell Programming and Scripting

First Script: Query every table with column xxx.

Hi all, Im new to scripting and have no idea how to start this. Recently I had to Query an Oracle database to find a count(distinct version) from every single table inside. I want to write this up into a script for the future. I have a template to connect to the database, so that is not the... (1 Reply)
Discussion started by: Iniquity
1 Replies

9. Shell Programming and Scripting

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 sqlplus <<END... (3 Replies)
Discussion started by: sveera
3 Replies

10. Shell Programming and Scripting

update a oracle table using shell script

Hi, 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... (2 Replies)
Discussion started by: ann_124
2 Replies
Login or Register to Ask a Question