Updating date field in oracle
The data types offer automatic initialization and updating to the current date and time.For more information, see Section 11.3.5, “Automatic Initialization and Updating for TIMESTAMP and DATETIME”.A link to this thread will be left in the introductions this time, however in future you can use the blue bar above to navigate through the forums Hi and Welcome to TSDN. You should have specified the error that you're getting and posted this in a relevant database forum.Which database are you using e.g with My SQL you'd have to do HI, DO THE FOLLOWING: 1.The TO_DATE function allows you to define the format of the date/time value.
I also think that there is no special reason why you take a string constant instead of a number constant. Use a number literal and write Because you started with string processing by inserting rows with the date represented as strings you can also make your correction using string processing.
USE THIS QUERY : SELECT DUEDATE, OLDDATE FROM FACTORYORDER; 2.
CHECK THE DATATYPE OF THIS TWO FIELDS AND THEN CHECK THE DATE FORMAT FOR THESE FIELDS. NOW USE THIS QUERY FOR UPDATE: UPDATE FACTORYORDER SET DUEDATE='30-JUL-2001' WHERE OLDDATE='06-JAN-2004'; NOTICE : ABOVE QUERY WILL UPDATE ALL THE RECORDS HAVING OLDDATE AS '06-JAN-2004'.
I would recommand always to use the appropriate datatypes, operators and functions and explicit conversion and not to use string literals and string processing and implicit conversion. The number result of the length function to a string or the string literal to a number. Do you know if there can any problems arise from this conversion?
Look at your statement The return type of the length statement is clearly a number. Is there a special reason why you take a string constant instead a number constant?