The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
S-361: Oracle Critical Patch Update - July 2008 iBot Security Advisories (RSS) 0 08-18-2008 05:10 PM
S-264: Oracle Critical Patch Update - April 2008 iBot Security Advisories (RSS) 0 04-17-2008 04:30 PM
Pro*C Update not working from Crontab alhallay UNIX for Advanced & Expert Users 2 09-16-2007 01:25 AM
apt-get update not working gauri UNIX for Dummies Questions & Answers 1 02-14-2006 07:02 AM
update a oracle table using shell script ann_124 Shell Programming and Scripting 2 12-18-2004 07:24 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-18-2009
RubinPat RubinPat is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 77
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 (permalink)  
Old 06-19-2009
rakeshawasthi rakeshawasthi is offline
Registered User
  
 

Join Date: Aug 2004
Location: India
Posts: 379

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 (permalink)  
Old 06-19-2009
RubinPat RubinPat is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 77
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 (permalink)  
Old 06-19-2009
rakeshawasthi rakeshawasthi is offline
Registered User
  
 

Join Date: Aug 2004
Location: India
Posts: 379
Not like that, your query was wrong. see the to_char in bold.
  #5 (permalink)  
Old 06-19-2009
RubinPat RubinPat is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 77
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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0