Oracle 到 Excel - PL/SQL 导出程序

2023-11-02数据库问题
0

本文介绍了Oracle 到 Excel - PL/SQL 导出程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在编写将数据从 Oracle 导出到 Excel 的 pl/sql 过程.我需要数据格式,所以我不能使用 CSV.我已经尝试过使用 XML,但是当我想导出时它会生成太大的文件,例如70000 行 50 列(几乎 300 MB!!!).

I’m writing pl/sql procedure that exports data from Oracle to Excel. I need data formatting so I can’t use CSV. I’ve already tried with XML but it generates too large files when I want to export e.g. 70000 rows with 50 columns (almost 300 MB!!!).

这就是我决定使用 HTML 标签生成 XLS 文件的原因——它比 XML 小,我必须直接定义一些特殊列的格式(字符串、数字和日期由 Excel 自动格式化).非常简单方便,但我不能定义多个工作表.

That’s why I decided to use HTML tags to generate XLS file – it is smaller than XML and I must directly define format of only some special columns (strings, numbers and dates are formatted automatically by Excel). It’s very simple and convenient but I can’t define more than one worksheet.

您知道如何在使用 HTML 编写的 Excel 文件中添加/定义多个工作表吗?我试过使用像 <% ActiveWorkbook.Worksheet.Add %> 这样的 VBScript 公式,但它不起作用.

Do you know how to add/define more than one worksheet in excel file written using HTML? I’ve tried to use VBScript formula like <% ActiveWorkbook.Worksheet.Add %>, but it doesn’t work.

推荐答案

您可以通过 ODBC 或 OLEDB 将 Oracle 数据提取到现有 Excel 文档中,而不是在 Oracle 服务器上创建 Excel 或 HTML 文件.缺点是,你应该小心用户权限.

Instead of creating Excel or HTML files on Oracle server, you can fetch Oracle data to existing Excel document via ODBC or OLEDB. The shortcoming is, that you should be careful with user permissions.

https://www.youtube.com/watch?v=Adz0zZFePf8

这篇关于Oracle 到 Excel - PL/SQL 导出程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)...
2024-04-16 数据库问题
13

创建分层定义的数据集的扁平表/视图
Creating a flattened table/view of a hierarchically-defined set of data(创建分层定义的数据集的扁平表/视图)...
2024-04-16 数据库问题
4

MySQL:如何做到行级安全(如 Oracle 的 Virtual Private Database)?
MySQL: how to do row-level security (like Oracle#39;s Virtual Private Database)?(MySQL:如何做到行级安全(如 Oracle 的 Virtual Private Database)?)...
2024-04-16 数据库问题
6

强制执行具有完整性约束的“子集"关系的最佳方法是什么
What is the best way to enforce a #39;subset#39; relationship with integrity constraints(强制执行具有完整性约束的“子集关系的最佳方法是什么)...
2024-04-16 数据库问题
7

使用 oracle SQL 按分隔符位置拆分字符串
Split String by delimiter position using oracle SQL(使用 oracle SQL 按分隔符位置拆分字符串)...
2024-04-16 数据库问题
46

如何根据列的值展开Oracle查询的结果
How to unfold the results of an Oracle query based on the value of a column(如何根据列的值展开Oracle查询的结果)...
2024-04-16 数据库问题
8