DECLARE
Fhandle utl_file. File_type;
Fp_buffer VARCHAR2 (4000);
File_name CLOB.
INT I;
The BEGIN
- file_name:='1. TXT';
Fhandle:=utl_file fopen (' WENSI_PRO ', '1. TXT', 'R');
File_name:=NULL;
I:=0;
WHILE I & lt;=5 LOOP
Utl_file. Get_line (fhandle fp_buffer);
File_name:=file_name | | CRH (13) | | fp_buffer;
IF fp_buffer='exit ($ret); 'THEN
The EXIT;
END the IF;
I:=I + 1;
END LOOP;
Dbms_output. Put_line (I);
Dbms_output. Put_line (file_name);
Utl_file. Fclose (fhandle);
The END;
CodePudding user response:
Reasons are already clear: inconsistent database and file character setSolution only:
1. Change the database character set, this is not recommended,
2. Change the file character set, and only this, the best version of the game, GB2312 to utf-8
You can put all the name of the file saved to a temporary table, then use cycle: for rec in (select filename from the temporary table)
Open use: utl_file. Fopen (' WENSI_PRO, rec. Filename, 'R'); Can,
CodePudding user response:
This method is the method to realize I nowCodePudding user response:
If available, use it,CodePudding user response:
But from the data source files are GB2312, every day a lot of the file, manually transcoding from volumeCodePudding user response: