Hi
I am a DBA - just been in the job two weeks and I would be grateful for some help.
I am trying to update a table with values from another table.
I have spent two days on this and I think I may have blown a fuse in my brain!
The 'from' table has 3 rows in it and the 'to' table has 3094.
I had problems importing the data in date format from a CSV file, so had to create the 'from' table with the date column as char, otherwise it wouldn't import the date.
There are definitely matching serial numbers in both tables and the from table definitely has a date value in DD/MM/RRRR format in the char column pertaining to the date.
The column in the 'to' table is date format.
This is my script:
update <schema_name>.< totable> s1
set <datecolumn>=
(select TO_DATE(<charco lumn>, 'DD/MM/RRRR')
from fromtable s2
where s1.SERIALNUMBER = s2.SERIALNUMBER );
It says it has updated 3094 rows but when I look at the date column, it has set all the rows to null, includign the 3 I am expecting it to update.
I am a DBA - just been in the job two weeks and I would be grateful for some help.
I am trying to update a table with values from another table.
I have spent two days on this and I think I may have blown a fuse in my brain!
The 'from' table has 3 rows in it and the 'to' table has 3094.
I had problems importing the data in date format from a CSV file, so had to create the 'from' table with the date column as char, otherwise it wouldn't import the date.
There are definitely matching serial numbers in both tables and the from table definitely has a date value in DD/MM/RRRR format in the char column pertaining to the date.
The column in the 'to' table is date format.
This is my script:
update <schema_name>.< totable> s1
set <datecolumn>=
(select TO_DATE(<charco lumn>, 'DD/MM/RRRR')
from fromtable s2
where s1.SERIALNUMBER = s2.SERIALNUMBER );
It says it has updated 3094 rows but when I look at the date column, it has set all the rows to null, includign the 3 I am expecting it to update.
Comment