473,394 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to update a table setting date as '11/30/2010 12:30:01 PM' in particular records?

kindly plz anyone can tell me what is the query for updating a table having one column createddatetime which is like '11/30/2010 12:30:01 PM'. i want to set some more records to that values using update command. how?
i can do it using for update.. by manually one by one...
but how to do it using update command? plz help me in this..
i tried this command Like this
"update <table_name> a
set a.createddatetime=to_char('11/30/2010 12:30:01 PM','mm/dd/rrrr hh:nn:ss PM')
where ......."

but it shows invalid number error...
Dec 4 '10 #1
2 37856
rski
700 Expert 512MB
Maybe like that
Expand|Select|Wrap|Line Numbers
  1. update <table_name> a
  2. set a.createddatetime=to_char('11/30/2010 12:30:01 PM','mm/dd/rrrr hh:mi:ss PM')
  3.  
Dec 4 '10 #2
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1. SQL> ed
  2. Wrote file afiedt.buf
  3.  
  4.   1* UPDATE test_1 set a = TO_CHAR('11/30/2010 12:30:01 PM','MM/DD/RRRR HH:MI:SS PM')
  5. SQL> /
  6. UPDATE test_1 set a = TO_CHAR('11/30/2010 12:30:01 PM','MM/DD/RRRR HH:MI:SS PM')
  7.                               *
  8. ERROR at line 1:
  9. ORA-01722: invalid number
  10.  
  11.  
  12. SQL> ed
  13. Wrote file afiedt.buf
  14.  
  15.   1* UPDATE test_1 set a = TO_DATE('11/30/2010 12:30:01 PM','MM/DD/RRRR HH:MI:SS PM')
  16. SQL> /
  17.  
  18. 1 row updated.
  19.  
  20. SQL> select TO_CHAR(a,'MM/DD/RRRR HH:MI:SS PM') from test_1;
  21.  
  22. TO_CHAR(A,'MM/DD/RRRRH
  23. ----------------------
  24. 11/30/2010 12:30:01 PM
  25.  
  26. SQL>  
  27.  
  28.  
  29.  
Dec 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: FN | last post by:
I'm new to javascript and internet research is turning up weird things. I just want to add 5 seconds to a date value. this = new date() // I believe this sets the time, too, right? //now how...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
9
by: Catherine Jo Morgan | last post by:
Can I set it up so that a certain combination of fields can't contain the same entries, on another record? e.g. a combination of FirstName/LastName/address? Or FirstName/LastName/phone? Or...
1
by: DL | last post by:
Hi, I have a table with quite a few fields wich saves al kind of activities on has done on one day. Most important to identify a unique record is the date and personID. A person is only allowed...
2
by: Keith Crooks | last post by:
Hi guys, I have a table with a date field in the format 01/12/04 what I need in the same table is a field that just takes the month and year from the date field. I have been told how to do...
9
by: MLH | last post by:
I have a database (datatrek.mdb) with a table named DATA. The table has a date/time field with default value = Now(). It has 100 records in it entered over a 50-minute period. I would like the...
2
by: (PeteCresswell) | last post by:
I'm currently presenting certain dates as YYYY/MM because Day=01 is understood. YYYY-MM, however, looks cleaner to my eye. But I can't get it to work with both .Format and .InputMask. They...
8
by: Grey | last post by:
I have following problem: table includes times for startup and end of operation as datetime field related to daily shift operations: dateid date starttime endtime 458 2006-12-29 22:00 ...
10
by: ashore | last post by:
Guys, the line below just returned "Dec 07" as the date for one month back from today. Hardly life-threatening, but any thoughts? <?php print date("M `y", mktime(0, 0, 0, date("m")-1, date("d"),...
2
by: shannonwhitty | last post by:
I am able to extract dates in the correct format i.e. SELECT CONVERT(VARCHAR(8), GETDATE(), 3) =dd/mm/yy My issue is that my users are selecting a date in this format and I need to select...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.