Excel中的Oracle查询输出 [英] Oracle query output in excel

查看:121
本文介绍了Excel中的Oracle查询输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Oracle 10G数据库,我需要编写一个相当简单的查询,该查询将两个表连接起来并选择一些数据.但是,我想将结果列表导出到excel,因此最终用户可以使用此.xls文档查看结果并按字段(位置)之一进行过滤

I have an Oracle 10G database and I need to write a fairly straightforward query that joins two tables and selects some data. However, I'd like to export the result list to an excel, so end users can use this .xls document to see the results and filter by one of the fields (location)

当我编写查询时,是否有一种简单的方法可以生成/创建一个可以容纳上述结果的excel文档? SQL不需要从excel内运行,但我想这是一个有用的功能! 谢谢.

When I write the query, is there an easy way I can generate/ create an excel document that would hold these results as described above? The SQL doesn't need to run from within excel, but I guess that would be a useful feature now that I think about it! Thanks.

推荐答案

您的请求有一个简单的解决方案.

There is simple solution for your request.

通过使用生成Excel xlsx文件的小型pl/sql软件包ora_excel,您可以选择数据并将所选数据导出到Excel并设置过滤.

By using ora_excel, small pl/sql package which generates Excel xlsx file, you can select data and export selected data to Excel and set filtering.

请参见以下示例:

BEGIN    
    ORA_EXCEL.new_document;    

    ORA_EXCEL.add_sheet('My sheet');        
    ORA_EXCEL.query_to_sheet('select * from employees'); -- Select data from database   
    ORA_EXCEL.set_cells_filter('A1', 'K1'); -- Add cell filtering from column A1 to column K1    


    -- Save generated Excel to file with name example.xlsx to Oracle folder EXAMPLE_XLSX
    ORA_EXCEL.save_to_file('EXPORT_DIR', 'example.xlsx'); 
END; 

有关更多详细信息,请在此处

For more details please check here

欢呼

这篇关于Excel中的Oracle查询输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆