rdarlin2 wrote:10,000ft overview of one way to do this:
I want to list several 'canned' SQL queries on one page as buttons or links; and have the result of selection be an immediate extract/download to excel of the data.
How can I best do this?
I suppose I could create separate hidden regions with their own reports that could somehow be referenced in the link. I would like to avoid doing all that, if I can create a package or process that includes the SQL query and that can be called in the link.
<li>Create 2 pages
create or replace package qry is function selector (p_req_qry in varchar2) return varchar2; end qry; / create or replace package body qry is function emp_qry return varchar2 is begin return 'select * from emp'; end emp_qry; function dept_qry return varchar2 is begin return 'select * from dept'; end dept_qry; function selector (p_req_qry in varchar2) return varchar2 is begin return case p_req_qry when 'EMP' then emp_qry() when 'DEPT' then dept_qry() end; end selector; end qry; /
*(o) Use Generic Column Names (parse query at runtime only)*
However this begs the question: Why bother? What's Excel got that APEX hasn't?
<ul> <li><a href="f?p=&APP_ID.:2:&SESSION.:EMP">Emp</a></li> <li><a href="f?p=&APP_ID.:2:&SESSION.:DEPT">Dept</a></li> </ul>