51: l_legislation_code per_business_groups.legislation_code%TYPE;
52: l_bg_name per_business_groups.name%TYPE;
53:
54: -- File Handling variables
55: l_file_type UTL_FILE.file_type;
56: l_filename VARCHAR2 (240);
57: l_location VARCHAR2 (4000);
58: l_line_read VARCHAR2 (4000) := NULL;
59:
235: END IF;
236:
237: -- Open flat file
238: l_file_type :=
239: UTL_FILE.fopen (l_location, l_filename, c_read_file, c_max_linesize);
240:
241: -- Create the Batch header
242: l_batch_id := hr_pump_utils.create_batch_header
243: (p_batch_name => p_batch_name,
252:
253: <
254: LOOP
255: BEGIN
256: UTL_FILE.get_line (l_file_type, l_line_read);
257: l_batch_seq := l_batch_seq + 1;
258: EXCEPTION
259: WHEN VALUE_ERROR
260: -- Input line too large for buffer specified in UTL_FILE.fopen
256: UTL_FILE.get_line (l_file_type, l_line_read);
257: l_batch_seq := l_batch_seq + 1;
258: EXCEPTION
259: WHEN VALUE_ERROR
260: -- Input line too large for buffer specified in UTL_FILE.fopen
261: THEN
262: IF UTL_FILE.is_open (l_file_type)
263: THEN
264: UTL_FILE.fclose (l_file_type);
258: EXCEPTION
259: WHEN VALUE_ERROR
260: -- Input line too large for buffer specified in UTL_FILE.fopen
261: THEN
262: IF UTL_FILE.is_open (l_file_type)
263: THEN
264: UTL_FILE.fclose (l_file_type);
265: END IF;
266:
260: -- Input line too large for buffer specified in UTL_FILE.fopen
261: THEN
262: IF UTL_FILE.is_open (l_file_type)
263: THEN
264: UTL_FILE.fclose (l_file_type);
265: END IF;
266:
267: hr_utility.set_location (l_proc, 50);
268: retcode := c_error;
637:
638: -- Commit the outstanding records
639: COMMIT;
640:
641: UTL_FILE.fclose (l_file_type);
642: hr_utility.set_location ( 'Leaving:'|| l_proc, 260);
643:
644: -- Most of these exceptions are not translated as they should not happen normally
645: -- If they do happen, something is seriously wrong and SysAdmin interference will be necessary.
648: WHEN e_fatal_error
649: -- No directory specified
650: THEN
651: -- Close the file in case of error
652: IF UTL_FILE.is_open (l_file_type)
653: THEN
654: UTL_FILE.fclose (l_file_type);
655: END IF;
656:
650: THEN
651: -- Close the file in case of error
652: IF UTL_FILE.is_open (l_file_type)
653: THEN
654: UTL_FILE.fclose (l_file_type);
655: END IF;
656:
657: hr_utility.set_location (l_proc, 270);
658: -- Set retcode to 2, indicating an ERROR to the ConcMgr
663:
664: -- Return the message to the ConcMgr (This msg will appear in the log file)
665: errbuf := hr_utility.get_message;
666:
667: WHEN UTL_FILE.invalid_operation
668: -- File could not be opened as requested, perhaps because of operating system permissions
669: -- Also raised when attempting a write operation on a file opened for read, or a read operation
670: -- on a file opened for write.
671: THEN
668: -- File could not be opened as requested, perhaps because of operating system permissions
669: -- Also raised when attempting a write operation on a file opened for read, or a read operation
670: -- on a file opened for write.
671: THEN
672: IF UTL_FILE.is_open (l_file_type)
673: THEN
674: UTL_FILE.fclose (l_file_type);
675: END IF;
676:
670: -- on a file opened for write.
671: THEN
672: IF UTL_FILE.is_open (l_file_type)
673: THEN
674: UTL_FILE.fclose (l_file_type);
675: END IF;
676:
677: hr_utility.set_location (l_proc, 280);
678: retcode := c_error;
677: hr_utility.set_location (l_proc, 280);
678: retcode := c_error;
679: errbuf := 'Reading File ('||l_location ||' -> ' || l_filename || ') - Invalid Operation.';
680:
681: WHEN UTL_FILE.internal_error
682: -- Unspecified internal error
683: THEN
684: IF UTL_FILE.is_open (l_file_type)
685: THEN
680:
681: WHEN UTL_FILE.internal_error
682: -- Unspecified internal error
683: THEN
684: IF UTL_FILE.is_open (l_file_type)
685: THEN
686: UTL_FILE.fclose (l_file_type);
687: END IF;
688:
682: -- Unspecified internal error
683: THEN
684: IF UTL_FILE.is_open (l_file_type)
685: THEN
686: UTL_FILE.fclose (l_file_type);
687: END IF;
688:
689: hr_utility.set_location (l_proc, 290);
690: retcode := c_error;
689: hr_utility.set_location (l_proc, 290);
690: retcode := c_error;
691: errbuf := 'Reading File (' || l_location || ' -> ' || l_filename || ') - Internal Error.';
692:
693: WHEN UTL_FILE.invalid_mode
694: -- Invalid string specified for file mode
695: THEN
696: IF UTL_FILE.is_open (l_file_type)
697: THEN
692:
693: WHEN UTL_FILE.invalid_mode
694: -- Invalid string specified for file mode
695: THEN
696: IF UTL_FILE.is_open (l_file_type)
697: THEN
698: UTL_FILE.fclose (l_file_type);
699: END IF;
700:
694: -- Invalid string specified for file mode
695: THEN
696: IF UTL_FILE.is_open (l_file_type)
697: THEN
698: UTL_FILE.fclose (l_file_type);
699: END IF;
700:
701: hr_utility.set_location (l_proc, 300);
702: retcode := c_error;
701: hr_utility.set_location (l_proc, 300);
702: retcode := c_error;
703: errbuf := 'Reading File (' || l_location || ' -> ' || l_filename || ') - Invalid Mode.';
704:
705: WHEN UTL_FILE.invalid_path
706: -- Directory or filename is invalid or not accessible
707: THEN
708: IF UTL_FILE.is_open (l_file_type)
709: THEN
704:
705: WHEN UTL_FILE.invalid_path
706: -- Directory or filename is invalid or not accessible
707: THEN
708: IF UTL_FILE.is_open (l_file_type)
709: THEN
710: UTL_FILE.fclose (l_file_type);
711: END IF;
712:
706: -- Directory or filename is invalid or not accessible
707: THEN
708: IF UTL_FILE.is_open (l_file_type)
709: THEN
710: UTL_FILE.fclose (l_file_type);
711: END IF;
712:
713: retcode := c_error;
714: errbuf := 'Reading File (' || l_location || ' -> ' || l_filename || ') - Invalid Path or Filename.';
713: retcode := c_error;
714: errbuf := 'Reading File (' || l_location || ' -> ' || l_filename || ') - Invalid Path or Filename.';
715: hr_utility.set_location (l_proc, 310);
716:
717: WHEN UTL_FILE.invalid_filehandle
718: -- File type does not specify an open file
719: THEN
720: IF UTL_FILE.is_open (l_file_type)
721: THEN
716:
717: WHEN UTL_FILE.invalid_filehandle
718: -- File type does not specify an open file
719: THEN
720: IF UTL_FILE.is_open (l_file_type)
721: THEN
722: UTL_FILE.fclose (l_file_type);
723: END IF;
724:
718: -- File type does not specify an open file
719: THEN
720: IF UTL_FILE.is_open (l_file_type)
721: THEN
722: UTL_FILE.fclose (l_file_type);
723: END IF;
724:
725: hr_utility.set_location (l_proc, 320);
726: retcode := c_error;
724:
725: hr_utility.set_location (l_proc, 320);
726: retcode := c_error;
727: errbuf := 'Reading File (' || l_location || ' -> ' || l_filename || ') - Invalid File Type.';
728: WHEN UTL_FILE.read_error
729:
730: -- Operating system error occurred during a read operation
731: THEN
732: IF UTL_FILE.is_open (l_file_type)
728: WHEN UTL_FILE.read_error
729:
730: -- Operating system error occurred during a read operation
731: THEN
732: IF UTL_FILE.is_open (l_file_type)
733: THEN
734: UTL_FILE.fclose (l_file_type);
735: END IF;
736:
730: -- Operating system error occurred during a read operation
731: THEN
732: IF UTL_FILE.is_open (l_file_type)
733: THEN
734: UTL_FILE.fclose (l_file_type);
735: END IF;
736:
737: hr_utility.set_location (l_proc, 330);
738: retcode := c_error;