Updating an Oracle row with value from same row

309 views Asked by At

I have a page set up where a user is viewing a component on a tabular form, with an auto generated classification for a component. The user can however decide that the auto generated classification is wrong, and override it by selecting a value from a select box, and on hitting submit the value in the select box needs to be updated to the current(old) classification. In short, how do you update row1 columnA with value from row1 columnB.
Select for the rows looks like this:

select 
"ROWID",
"GROUP_ID",
"COMPONENT",
"DESCRIPTION",
"MANUFACTURER",
"MODEL",
"OBJECT_TYPE",
"QUALITY_CLASS",
"ASME",
"VALIDATED",
'' as updated_group_id,
"COMPONENT_ID"
from "TBL_COMPONENT"
where GROUP_ID = :P5_X --P5_X is an invisible item on my page to store a value

This is inside an Oracle APEX editor. The update statement for group_id currently looks like this, and it's broken.

update tbl_component
if update_group_id is not null
set group_id = updated_group_id
where updated_group_id = :P5_X
end if;

If it looks like I don't know Oracle very well, it's because I don't.

0

There are 0 answers