我正在使用 ExcelDocTypeUtils pkg 将查询数据导出到 EXCEL 文件。当我运行该程序时,我得到一个 excel 文件,但是当我尝试打开它时,会弹出此错误:
Program came up in the following areas during load: Style
我认为失败的原始行是:
-- Prepare Headers
owa_util.mime_header('application/vnd.ms-excel',FALSE);
我已经尝试过设置:
<?xml version="1.0" encoding="UTF-8"?>'
但是当我这样做时,错误变为以下内容:
Program came up in the following areas during load: 'Strict Parse Error'
这是我执行程序的方式:
/* Starts */
execute employeereport;
CREATE OR REPLACE PROCEDURE employeeReport AS
v_sql_salary VARCHAR2(200) := 'SELECT last_name,first_name,salary FROM hr.employees ORDER BY last_name,first_name';
v_sql_contact VARCHAR2(200) := 'SELECT last_name,first_name,phone_number,email FROM hr.employees ORDER BY last_name,first_name';
v_sql_hiredate VARCHAR2(200) := 'SELECT last_name,first_name,to_char(hire_date,''MM/DD/YYYY'') hire_date FROM hr.employees ORDER BY last_name,first_name';
excelReport ExcelDocumentType := ExcelDocumentType();
v_worksheet_rec ExcelDocTypeUtils.T_WORKSHEET_DATA := NULL;
v_worksheet_array ExcelDocTypeUtils.WORKSHEET_TABLE := }
ExcelDocTypeUtils.WORKSHEET_TABLE();
documentArray ExcelDocumentLine := ExcelDocumentLine();
v_file UTL_FILE.FILE_TYPE;
BEGIN
-- Salary
v_worksheet_rec.query := v_sql_salary;
v_worksheet_rec.worksheet_name := 'Salaries';
v_worksheet_rec.col_count := 3;
v_worksheet_rec.col_width_list := '25,20,15';
v_worksheet_rec.col_header_list := 'Lastname,Firstname,Salary';
v_worksheet_array.EXTEND;
v_worksheet_array(v_worksheet_array.count) := v_worksheet_rec;
-- Contact
v_worksheet_rec.query := v_sql_contact;
v_worksheet_rec.worksheet_name := 'Contact_Info';
v_worksheet_rec.col_count := 4;
v_worksheet_rec.col_width_list := '25,20,20,25';
v_worksheet_rec.col_header_list := 'Lastname,Firstname,Phone,Email';
v_worksheet_array.EXTEND;
v_worksheet_array(v_worksheet_array.count) := v_worksheet_rec;
-- Contact
v_worksheet_rec.query := v_sql_hiredate;
v_worksheet_rec.worksheet_name := 'Hiredate';
v_worksheet_rec.col_count := 3;
v_worksheet_rec.col_width_list := '25,20,20';
v_worksheet_rec.col_header_list := 'Lastname,Firstname,Hiredate';
v_worksheet_array.EXTEND;
v_worksheet_array(v_worksheet_array.count) := v_worksheet_rec;
owa.num_cgi_vars := NVL(owa.num_cgi_vars, 0);
excelReport := ExcelDocTypeUtils.createExcelDocument(v_worksheet_array);
documentArray := excelReport.getDocumentData;
v_file := UTL_FILE.fopen('C:\','test.xml','W',4000);
FOR x IN 1 .. documentArray.COUNT LOOP
UTL_FILE.put_line(v_file,documentArray(x));
END LOOP;
UTL_FILE.fclose(v_file);
--excelReport.displayDocument;
END;