I have a table (in informix ) which stores two columns :empId and status (Y/N). There are some other scripts which, when run, update the status of these employeeIDs based on certain conditions.
The task at hand is , a user provides a path to a file containing employee-IDs. I have a script which then looks at this file and does a “load from user_supplied_file insert into employeeStatusTable”.
All the employeeIDs mentioned in this file are to be inserted in this table with the status ‘N’. Th real issue is the user-supplied file may contains an employeeId that is already present in the table with the status updated to ‘Y’ (by some other script or job). In this case, the existing entry should get overwritten. In short, the entry in the table should read “empId”, “N”.
Is there any way to acheive this? Thanks in advance.
As far I know , the LOAD statement is limited to use together of INSERT statement.
I pretty sure there a lot of ways to do this , I will suggest two way:
In both cases, is supported only for database version >= 11.50 and have certain limitations like:
SUGGESTION 1
Load into a temporary table and then use the MERGE statement.
SUGGESTION 2
Create a external table to you TXT file and then just use the MERGE or UPDATE using this table when needed.