调用应用程序进程,将其保存/下载为附件

时间:2016-02-05 16:46:53

标签: oracle attachment oracle-apex procedure

我有一个调用应用程序进程的报告链接(在经典样式顶点报告中)。它在REQUEST属性上设置,如下所示:

APPLICATION_PROCESS=profile

应用程序进程在包内调用过程(过程名称也是“profile”)。申请程序如下:

declare
begin
    util_pck.profile(:ID)
end;

该包在网页内生成一些文本。单击链接后,我需要它来提示用户下载或保存为与其mime类型相关的附件(我认为是.pro),而不是生成文本。我想我错过了一些关键的代码行。程序如下:

procedure profile(profileid in number, debug in varchar2 default null) is 
cursor svyc is select p.profile_start_x, p.profile_start_y, 
p.surveying_org_full_name, p.survey_job_title, m.filename, m.vertical_accuracy_type, 
                      m.horizontal_datum, m.vertical_datum, m.epoch, m.projection_zone, m.units_of_measure, 
                      m.survey_job_number, m.survey_start_date  from survey_profiles_view p 
                      left join survey_metadata_view m on m.survey_id = p.survey_id 
                      where p.survey_profile_id = profileid;
svycitem svyc%rowtype;
cursor proc is select geom.x, geom.y, pp.* from survey_profile_pts_view pp, table(sdo_util.getvertices(pp.shape)) geom where survey_profile_id = profileid;
pro proc%rowtype;

begin
open svyc;
fetch svyc into svycitem;
owa_util.mime_header('text/plain', false);
owa_util.http_header_close;

htp.p('T01   FILE NAME  : ' || rpad(svycitem.filename, 22) || ' ORDER: ' || rpad(svycitem.vertical_accuracy_type, 10)|| ' HORIZ. DATUM: ' || svycitem.horizontal_datum || chr(13));
htp.p('T02   JOB NUMBER : ' || rpad(svycitem.survey_job_number,22)|| ' UNITS: ' || rpad(svycitem.units_of_measure, 10) || ' VERT.  DATUM: ' || svycitem.vertical_datum || chr(13));
htp.p('T03   SURVEY DATE: ' || rpad(svycitem.survey_start_date, 22) || ' ZONE : ' || rpad(svycitem.projection_zone, 10) || '        EPOCH: ' || svycitem.epoch ||chr(13));
htp.p('T04   BANK REF.  :                      CHANNEL:                                                     ' || chr(13));
htp.p('T05   CONTRACTOR : ' || svycitem.surveying_org_full_name || chr(13));
htp.p('T06   LEVEE DIST.: ' || chr(13));
htp.p('T07   TITLE      : ' || svycitem.survey_job_title || chr(13));
for pro in proc loop
  htp.p(lpad(to_char(round(pro.station, 2), '9999990.99'), 15) || lpad(to_char(round(pro.x, 2), '9999990.99'), 15) || lpad(to_char(round(pro.y, 2), '9999990.99'),15) || lpad(to_char(round(pro.elevation,2),'9990.99'),8) || ' ' || pro.point_code );
end loop;

close svyc;

end;

我知道我需要行wpg_docload.download_file( );,但我不确定在哪里,或者我的代码顺序是否正确。对此的任何帮助都会很棒。提前致谢

0 个答案:

没有答案