Newbie PLSQL devekoper needs help
Hi. these are my requirements
1.read a csv file that has 3 fields
employee_id,department_name,subdepartment_name
2.compare that data with table sop_departments that has columns: department_name,
subdepartment_name and employee_id from sop_employee
Compare the data. if the csv file has a new record then insert it into sop_employees
insert it into sop employee: values employee_id and department_id from (sop_departments).
I started putting the pl sql together but I am not good with pl sql
=============================================================
CREATE OR REPLACE PROCEDURE LOAD_SOP_DATA IS
file_handle UTL_FILE.FILE_TYPE
department_name CHAR;
subdepartment_name CHAR;
retrieved_buffer VARCHAR2(100);
BEGIN
CURSOR COMPARE
IS
select department_name, subdepartment_name
...............
...............
..............
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('no_data_found');
UTL_FILE.FCLOSE(file_handle);
WHEN UTL_FILE.INVALID_PATH THEN
DBMS_OUTPUT.PUT_LINE('UTL_FILE.INVALID_PATH');
UTL_FILE.FCLOSE(file_handle);
WHEN UTL_FILE.READ_ERROR THEN
DBMS_OUTPUT.PUT_LINE(' UTL_FILE.READ_ERROR');
UTL_FILE.FCLOSE(file_handle);
END;
Thanks in advance for help