CREATE OR REPLACE PROCEDURE read_external_file(p_dir IN VARCHAR2, p_filename IN VARCHAR2) IS v_file UTL_FILE.FILE_TYPE;
    l varchar2(50);
BEGIN
    v_file:= UTL_FILE.FOPEN (p_dir, p_filename, 'r');
    DBMS_OUTPUT.PUT_LINE('Enrollment Report');
    LOOP
      UTL_FILE.GET_LINE(v_file,l,50);
      DBMS_OUTPUT.PUT_LINE(l);
    END LOOP;
    UTL_FILE.FCLOSE (v_file);
    EXCEPTION
        WHEN NO_DATA_FOUND THEN
            UTL_FILE.FCLOSE(v_file);
            DBMS_OUTPUT.PUT_LINE('End of file '||p_filename);
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE('SQLERRM: ' || SQLERRM);
            DBMS_OUTPUT.PUT_LINE('SQLCODE: ' || SQLCODE);
END read_external_file;

 

apelul

 

begin
   read_external_file('WF_FLAGS','student_class_list.txt');
end