DECLARE W_file_path VARCHAR2 (4000): = ' xxif_input '; --all_directories.directory_name w_file_name VARCHAR2 (4000): = ' lcytest001.csv '; --the file name W_file_exists BOOLEAN; W_file_length Number (Ten) DEFAULT 0; W_file_type Utl_file.file_type; W_line VARCHAR2 (4000) DEFAULT NULL; W_rec_count number: = 1; W_block_size Binary_integer; --TYPE Tbl_varchar2 is TABLE of VARCHAR2 (4000) INDEX by Binary_integer; Rec_record tbl_varchar2; BEGIN--fnd_global.apps_initialize (user_id = 1110, resp_id = 50683, resp_appl_id = 222); --Utl_file.fgetattr (W_file_path, W_file_name, W_file_exists, W_ File_length, w_block_size); IF not W_file_exists then Dbms_output.put_line (' The file was not exist! '); END IF; --IF w_file_length = 0 Then Dbms_output.put_line (' The file is empty! '); END IF; --W_file_type: = Utl_file.fopEn (location = w_file_path, filename = w_file_name, Open_mode = ' r ', max_linesize = 32767); LOOP utl_file.get_line (W_file_type, W_line, 32767); Dbms_output.put_line (' information is: ' | | w_line); Rec_record (w_rec_count): = W_line; W_rec_count: = W_rec_count + 1; END LOOP; EXCEPTION when No_data_found then Utl_file.fclose (W_file_type); END;
SQL Script for read information from a CSV file in FTP Server