I am trying to fix an issue for a customer which requires us to update a column in a table with the value in the column concatenated (||) with the value in another row in the same table.
The table holds comments on data items, where the data is held in datasets. Each year a new dataset is created by copying the previous years dataset but there is a problem where some of the comments were not copied and new comments have been added and they need to be merged.
I used to be an oracle wiz but am very rusty after 8 years of project managing, my developer is on leave and the fix he put in place doesn't work, so am trying to fix it myself:
This sql runs but the result is all rows are updated and the comment_text is now blank.
update
mx_comments
set
comment_text =
(
select comment_text||a .comment_text
from
mx_comments a
where
identnr = a.identnr
and
table_id = a.table_id
and
field_id = a.field_id
and
data_set_id2 = '&&to_data_se t'
and
a.data_set_id2 = '&&from_data_se t_id')
Any help would be appreciated
The table holds comments on data items, where the data is held in datasets. Each year a new dataset is created by copying the previous years dataset but there is a problem where some of the comments were not copied and new comments have been added and they need to be merged.
I used to be an oracle wiz but am very rusty after 8 years of project managing, my developer is on leave and the fix he put in place doesn't work, so am trying to fix it myself:
This sql runs but the result is all rows are updated and the comment_text is now blank.
update
mx_comments
set
comment_text =
(
select comment_text||a .comment_text
from
mx_comments a
where
identnr = a.identnr
and
table_id = a.table_id
and
field_id = a.field_id
and
data_set_id2 = '&&to_data_se t'
and
a.data_set_id2 = '&&from_data_se t_id')
Any help would be appreciated
Comment