oracle update not working


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users oracle update not working
# 1  
Old 06-18-2009
oracle update not working

Hi,

I have a oracle source with a field my_date =06/02/2009

I am trying to update the table to SYSDATE with a myscript.sql where I have

UPDATE table set my_date=to_DATE(SYSDATE,'MM/DD/YYYY');

Now I try to run it with myupdate.SH script where I have

sqlplus nolog @myscript.sql

But here I have a peculiar problem when I run the script in oracle it updates the table but when I run with this script myupdate.SH it gives me a error not a valid month.

Is there any way I can solve this. or any way I can connect to my oracle table and update the date field to SYSDATE in mm/dd/yyyy format. Pls help.Thanks
# 2  
Old 06-19-2009
Code:
sqlplus -s <<!
login/passwd@db
set heading off pause off termout off verify off feedback off pagesize 0 linesize 150
update <table> set my_date=to_char(SYSDATE,'MM/DD/YYYY');
!`

# 3  
Old 06-19-2009
Rakesh,

I didn't get it...is it that without

set heading off pause off termout off verify off feedback off pagesize 0 linesize 150

update statement won't work..why is it?
# 4  
Old 06-19-2009
Not like that, your query was wrong. see the to_char in bold.
# 5  
Old 06-19-2009
But I dont want my oracle table datatype to change to char...I want to keep it as date and also I tried ur solution ,,,it still gives me the same problem
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. AIX

AIX SP update and Oracle interaction

Situation: AIX 7.1 various SP levels Update to SP9 on DB systems with Oracle 10 or 11G Steps: Apply SP9 update Bring down databases shutdown -Fr Check system health - AIX Bring up databases Confirm functionality Would applying the update while the databases are up cause problems... (7 Replies)
Discussion started by: allenhibbert
7 Replies

2. 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

3. Shell Programming and Scripting

Can't get While loop working with rrdtool update

I have data in a CSV file that looks like; 1353557880:1.111:123.3 1353557940:1.113:123.3 1353558000:1.118:123.3 1353558060:1.123:123.3 1353558120:1.218:123.3 I'm running the following; while IFS=":" read d a b; do rrdtool update temp.rrd $d:$a:$b; done <temp6 It gives me the following... (2 Replies)
Discussion started by: ottsm
2 Replies

4. Solaris

Update Manager Not Working

Hello I reinstalled my OS today and after going through the registration the updatemanager pops up, as expected. The problem is all i get is an error message box that's completely blank. The icon in the sytem tray is a blue question mark and when hovering over it, it says i'm not... (4 Replies)
Discussion started by: jpg.2009
4 Replies

5. UNIX for Advanced & Expert Users

Pro*C Update not working from Crontab

Dear All, I have writen a Pro*c program that does a data base select,insert,update statements and I have scheduled the program to run from crontab, It is runing fine for the select insert and commit statement till it reaches the update statement , it throws the following error: SQL On IPB... (2 Replies)
Discussion started by: alhallay
2 Replies

6. UNIX for Dummies Questions & Answers

apt-get update not working

Hi all, Till now i was able to do apt-get update. but today i started to the following error: # apt-get update E: Could not open lock file /var/lib/apt/lists/lock - open (2 No such file or directory) E: Unable to lock the list directory # Could any one let me know how to solve it. ... (1 Reply)
Discussion started by: gauri
1 Replies

7. 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