Você está na página 1de 7

23/03/12

Storing and Accessing Reports in the Database

Storing and Accessing Reports in the Database


Purpose
Thi ia h h e a d acce a e i he da aba e.

Time to Complete
A i a e 15 i e

Topics
Thi ia c e he f i g ic :

O e ie Pee i ie Creating a Table to Store Your Reports Generating and Storing a Report in the Database Accessing the Stored Report in the Database S a

Viewing Screenshots
Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneousl , so response time ma be slow depending on our Internet connection.) Note: A e a i e , ca ace he c c ee h a cia ed i h ha e . Y e a i di id a ic ca hide a i di id a i he f c ee h i g e b c ic i g i . ad a d ie he

Overview
Begi i g i h O ac e A i c ea e a e ab e ica i E e e he e 3.1, ca ea e i a BLOB c ha a e ge e a ed a d he c ea e a e i f he c da aba e. I hi e f he ab e. Bac T ia , ic Li

Prerequisites
Bef e 1. 2. Pe f Pe f ef hi ia , h d: ia . ia . Bac T ic Li

he C ea i g a PDF Re i h M i e Q e ie he I c di g D a ic I age i Y Re

Creating a Table to Store Your Reports


I hi ec i e : O e ca h , ad a d a ci ha c ea e a ab e e he e ha ge e a e. Pe f he f i g

1.

b ,

e a d e e he f ecific h a e

i g URL gi O ac e A a e . ac e.c ).

ica i

(cha ge he <h

a e>

http://<hostname>:8080/apex

2.

gi

O ac e A

ica i

, e e he f

i g de ai , a d c ic Login.
1/7

.oracle.com/ ebfolder/technet ork/tutorials/obe/db/hol08/ape prnt/ape prnt3_otn.htm

23/03/12

Storing and Accessing Reports in the Database

W ace: <your workspace name> U e a e: <your username> Pa d: <your password>

3.

C ic

he SQL Workshop ab. The c ic SQL Scripts.

4.

C ic Upload.

5.

C ic Browse... a d e ec he r e p o r t _ a r c h ie _ t b l . s q lfi e ( ca ed e e i i e fi e ) a d c ic Open.

he e

aded a d

ed he

6.

C ic Upload.

7.

C ic

he r e p o r t _ a r c h ie _ t b l . s q l ci

ic

8.

C ic Run.

9.

C ic Run

fi

10. C ic

he View Results ic

11. The r e p o r t _ a r c h i e ab e

a c ea ed

cce

.oracle.com/ ebfolder/technet ork/tutorials/obe/db/hol08/ape prnt/ape prnt3_otn.htm

2/7

23/03/12

Storing and Accessing Reports in the Database

Bac

ic Li

Generating and Storing a Report in the Database


I 1. hi ec i Na iga e , c ea e a he A ica i ce ha e he e i he da aba e. Pe f he f i g e :

B i de . Se ec he Printing Application.

2.

C ic

he Home age.

3.

eed

c ea e a

ce

ha

e he e

he da aba e. U de P ce

e , c ic

he C ea e ic

4.

Se ec PL/SQL a d c ic Next.

5.

E e store_blobquery_report f

he Na e a d c ic Next.

6.

E e he f

i g c de i

he PL/SQL Page P ce

a ea a d c ic Next.

declare l_report blob; begin l_report := apex_util.get_print_document ( p_application_id => :APP_ID, p_report_query_name => 'blobquery', p_report_layout_name => 'blobquery', p_report_layout_type => 'rtf', p_document_format => 'pdf' ); insert into report_archive ( filename, mimetype, report, created_date, created_by ) values ( 'BLOB Query Search Results (' to_char(sysdate,'DDMonYYYY') ')', 'application/pdf', l_report, sysdate, :USER ); end;
.oracle.com/ ebfolder/technet ork/tutorials/obe/db/hol08/ape prnt/ape prnt3_otn.htm 3/7

23/03/12

Storing and Accessing Reports in the Database

7.

C ic Next.

8.

Se ec PRINT_REPORT_WITH_IMAGES f

Whe B

Pe

ed a d c ic Create Process.

9.

c ea e a

ce

e he M

iQ e

. U de P ce

e , c ic

he C ea e ic

10. Se ec PL/SQL a d c ic Next.

11. E e store_multiquery_report f

he Na e a d c ic Next.

12. E e he f

i g c de i

he PL/SQL Page P ce

a ea a d c ic Next.

declare l_report blob; begin l_report := apex_util.get_print_document ( p_application_id => :APP_ID, p_report_query_name => 'multiquery', p_report_layout_name => 'multiquery', p_report_layout_type => 'rtf', p_document_format => 'pdf' ); insert into report_archive ( filename, mimetype, report, created_date, created_by ) values ( 'Multi Query Search Results (' to_char(sysdate,'DDMonYYYY') ')', 'application/pdf', l_report, sysdate, :USER ); end;

.oracle.com/ ebfolder/technet ork/tutorials/obe/db/hol08/ape prnt/ape prnt3_otn.htm

4/7

23/03/12

Storing and Accessing Reports in the Database

13. C ic Next.

14. Se ec PRINT_REPORT f

Whe B

Pe

ed a d c ic Create Process.

15. C ic Run.

16. C ic Print Report With Images. Whe

he dia g e

a e he e

ea ,

ca c ic Cancel.

17. C ic Print Report. Whe

he dia g e

a e he e

ea ,

ca c ic Cancel.

N e: T

e ei

e ed i

he da aba e f

each e

a .

Bac

ic Li

Accessing the Stored Report in the Database


I 1. hi ec i Na iga e , c ea e a e Pi i gA f he da a i ica i he e _a chi e ab e i he Home age. he da aba e. Pe f he f i g e :

age. C ic

2.

U de Regi

, c ic

he C ea e ic

3.

Se ec Report a d c ic Next.

4.

Ma e

e SQL Report i

e ec ed a d c ic Next.

.oracle.com/ ebfolder/technet ork/tutorials/obe/db/hol08/ape prnt/ape prnt3_otn.htm

5/7

23/03/12

Storing and Accessing Reports in the Database

5.

E e List of Stored Reports f

Ti e a d c ic Next.

6.

E e he f

i g SQL i

he SQL Q e

a ea a d c ic Create Region.

SELECT id, filename, mimetype, created_date, created_by, dbms_lob.getlength(report) report_length FROM report_archive

7.

The e Report i

a c ea ed. Y .

eed

a e a fe

cha ge

he Re

A ib e . U de Regi

, e ec he

8.

U de Headi g T e, c ic Custom. Cha ge he a e f he Re Le g h heade Report. De e ec he Sh chec b f MIMETYPE. Y a a c ea e a i d ad he e i he Re Le g h c . Se ec he edi ic f Re Le g h.

9.

U de C

a i g, e e he f

i g

i gi

he N

be / Da e F

a fie d a d c ic Apply Changes.

DOWNLOAD:REPORT_ARCHIVE:REPORT:ID::MIMETYPE:FILENAME:::inline:[Download] N e hi i gc ai he f i g a a ee : >:<P i a Ke C >:<D ad Li Te > 1>::<MIME T e C >:

<F a Ma >:<BLOB Tab e>:<BLOB C <Fi e a e C >:::<C e Di ii

10. C ic Run Page.

11. The i f e [Download] i

ha .

a i

he

e i

ec i

f hi

ia a e i

he i . T

ie

a e

, c ic

he

12. The e

i di

a ed

cce

.
6/7

.oracle.com/ ebfolder/technet ork/tutorials/obe/db/hol08/ape prnt/ape prnt3_otn.htm

23/03/12

Storing and Accessing Reports in the Database

Bac

ic Li

Summar
I hi ia , ea ed h e ea e ed e i : e i he da aba e he da aba e Bac Place the cursor over this icon to hide all screenshots. T ic Li

C ea e a ab e Ge e a e a d Acce he

.oracle.com/ ebfolder/technet ork/tutorials/obe/db/hol08/ape prnt/ape prnt3_otn.htm

7/7

Você também pode gostar