Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UPDATE Statement with Dynamic Column Selection as Target

User_M80CRSep 9 2021

Hello Support,

Oracle Live SQL - Script: SCOTT_TIGER (0 Bytes)In the above livesql script, I created the following two extra table from the baseline SCOTT EMP/DEPT script:
-- update_column_selection_mask = 1 -- will update emp.ename column
-- update_column_selection_mask = 2 -- will update emp.job column
-- update_column_selection_mask = 4 -- will update emp.mgr column
-- update_column_selection_mask = 8 -- will update emp.hireate column
-- update_column_selection_mask = 16 -- will update emp.sal column
-- update_column_selection_mask = 32 -- will update emp.comm column
-- update_column_selection_mask = 64 -- will update emp.deptno column
create table emp_column_update (
emp_ptr primary key references emp,
update_column_selection_mask number(3,0)
);
create table emp_update_data(
emp_update_ptr primary key references emp,
ename varchar2(10),
job varchar2(9),
mgr number(4,0),
hiredate date,
sal number(7,2),
comm number(7,2),
deptno number(2,0)
);
Can you please help me with the EMP Table respective record value UPDATE statement which will select the target Column Names of EMP Table based on the emp_column_update.update_column_selection_mask value and corresponding column new values from emp_update_data table?
Best Regards

This post has been answered by BluShadow on Sep 10 2021
Jump to Answer
Comments
Post Details
Added on Sep 9 2021
14 comments
1,725 views