Can anyone please assist me?
I have attached 2 input files and one output file. I need to generate the sql update statements using the above 2 input files. if input_file2 has 5 rows, then we should generate 5 update statements because column1 is unique. input_file1 and input_file2 may contain more columns. I have added only few columns in my sample files. The output file should generate the sql update statements for the uncommented columns, but the positions should be correct.
#
INPUTFILE1:
#empno
ename
job
#manager
salary
#commision
deptno
Input _file2:
7839,KING,PRESIDENT,MANAGER,2000,100,10
7840,BLAKE,ANALYST,MANAGER1,1000,50,13
7841,CLARK,PROGRAMMER,MANAGER2,500,40,13
7842,JONES,PROGRAMMER,MANAGER,550,40,11
7843,SCOTT,ANALYST,MANAGER,550,40,11
Desired output:
UPDATE EMP
SET ename='KING',
job='PRESIDENT',
salary='2000',
deptno='10'
WHERE empno=7839;
commit;
UPDATE EMP
SET ename='BLACK',
job='ANALYST',
salary='1000',
deptno='13'
WHERE empno=7840;
commit;
UPDATE EMP
SET ename='CLARK',
job='PROGRAMMER',
salary='500',
deptno='13'
WHERE empno=7841;
commit;
UPDATE EMP
SET ename='JONES',
job='PROGRAMMER',
salary='550',
deptno='11'
WHERE empno=7842;
commit;
UPDATE EMP
SET ename='SCOTT',
job='ANALYST',
salary='550',
deptno='40'
WHERE empno=7843;
commit;
Please let me know if you need any other clarification.
Thanks