我正在使用Apex 5将csv文件加载到Oracle中的表中。我的代码如下。
The problem is when I have loaded the csv file, I noticed that is not inserting special characters like "á,é,í,ó,ú,ñ" . what can I do?
For example if I have in csv file column "last_name" with "Álvarez" value when I load the file into Oracle I see in the table " lvarez"
this csv file has more than 50 columns
声明
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len NUMBER:= 1;
v_line VARCHAR2(32767):= NULL;
v_data_array wwv_flow_global.vc_arr2;
v_rows NUMBER;
v_sr_no NUMBER:= 1;
--v_first_line_done布尔值:= false;
v_error_cd NUMBER:= 0;
v_count NUMBER;
BEGIN
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
WHILE ( v_position <= v_blob_len )
LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex2dec(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
IF v_char = CHR(10) THEN
--v_line := REPLACE (v_line, '|', ',');
v_data_array := wwv_flow_utilities.string_to_table (v_line,'|');
IF v_sr_no = 1 THEN
null;
ELSE
APEX_DEBUG.MESSAGE(v_sr_no);
insert into TABLE_A(
column1,
column2,
column3,
..... )
values
(v_data_array(1), v_data_array(2), v_data_array(3), ...... );
END IF;
COMMIT;
v_line := NULL;
v_sr_no := v_sr_no + 1;
END IF;
END LOOP;