-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathaop_sample3_db_obj.sql
325 lines (310 loc) · 12.4 KB
/
aop_sample3_db_obj.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
--------------------------------------------------------
-- DDL for Table AOP_AUTOMATED_TEST
--------------------------------------------------------
CREATE TABLE "AOP_AUTOMATED_TEST"
( "ID" NUMBER,
"DESCRIPTION" VARCHAR2(4000),
"DATA_TYPE" VARCHAR2(20),
"TEMPLATE_TYPE" VARCHAR2(20),
"OUTPUT_TYPE" VARCHAR2(20),
"OUTPUT_FILENAME" VARCHAR2(200),
"OUTPUT_BLOB" BLOB,
"EXPECTED_BYTES" NUMBER,
"RECEIVED_BYTES" NUMBER,
"RESULT" VARCHAR2(4000),
"PROCESSING_SECONDS" NUMBER,
"SEQ_NR" NUMBER,
"DATA_SOURCE" VARCHAR2(4000),
"TEMPLATE_SOURCE" VARCHAR2(4000),
"FILENAME" VARCHAR2(221),
"OUTPUT_TYPE_ITEM_NAME" VARCHAR2(100),
"OUTPUT_TO" VARCHAR2(100),
"SPECIAL" VARCHAR2(100),
"PROCEDURE_" VARCHAR2(100),
"CREATED_DATE" DATE DEFAULT sysdate,
"RUN_DATE" DATE,
"APP_ID" NUMBER,
"PAGE_ID" NUMBER,
INIT_CODE VARCHAR2(4000),
ACTIVE VARCHAR2(1)
) ;
--------------------------------------------------------
-- DDL for Table AOP_OUTPUT
--------------------------------------------------------
CREATE TABLE "AOP_OUTPUT"
( "ID" NUMBER,
"OUTPUT_BLOB" BLOB,
"FILENAME" VARCHAR2(200),
"MIME_TYPE" VARCHAR2(200),
"LAST_UPDATE_DATE" DATE
) ;
--------------------------------------------------------
-- DDL for Table AOP_TEMPLATE
--------------------------------------------------------
CREATE TABLE "AOP_TEMPLATE"
( "ID" NUMBER,
"TEMPLATE_BLOB" BLOB,
"FILENAME" VARCHAR2(200),
"MIME_TYPE" VARCHAR2(200),
"LAST_UPDATE_DATE" DATE,
"TEMPLATE_TYPE" VARCHAR2(20),
"DESCRIPTION" VARCHAR2(4000)
) ;
CREATE OR REPLACE TRIGGER "AOP_OUTPUT_IUTRG"
before insert on AOP_OUTPUT
for each row
begin
if :new.id is null
then
:new.id := to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
end if;
end;
/
CREATE OR REPLACE TRIGGER "AOP_TEMPLATE_IUTRG"
before insert ON aop_template FOR EACH ROW
BEGIN
if :new.id is null
then
:new.id := to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
end if;
END;
/
CREATE OR REPLACE TRIGGER "AOP_AUTOMATED_TEST_IUTRG"
before insert on AOP_AUTOMATED_TEST
for each row begin
if :new.id is null
then
:new.id := to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
end if;
end;
/
SET DEFINE OFF;
Insert into AOP_AUTOMATED_TEST (ID,DESCRIPTION,DATA_TYPE,TEMPLATE_TYPE,OUTPUT_TYPE,OUTPUT_FILENAME,EXPECTED_BYTES,RECEIVED_BYTES,RESULT,PROCESSING_SECONDS,SEQ_NR,DATA_SOURCE,TEMPLATE_SOURCE,OUTPUT_TYPE_ITEM_NAME,OUTPUT_TO,SPECIAL,PROCEDURE_,CREATED_DATE,RUN_DATE,APP_ID,PAGE_ID) values (79154343032776274722465249329506393396,'Page: 25: Print Column Chart (multi-serie) Pptx','SQL','APEX','pptx','p25_output_multiple_charts',33925,33925,'ok',0,41,'with both_lines as
(
SELECT
''line 1'' line_name,
NULL AS LINK,
rownum AS x,
o.order_total AS y
FROM demo_customers c,
demo_orders o
WHERE c.customer_id = o.customer_id
union all
SELECT
''line 2'' line_name,
NULL AS LINK,
rownum AS x,
o.order_total*1.21/rownum AS y
FROM demo_customers c,
demo_orders o
WHERE c.customer_id = o.customer_id
),
lines as (select ''line 1'' line_name from dual
union all
select ''line 2'' line_name from dual),
both_columns as
(
SELECT
''column 1'' column_name,
c.cust_first_name || '' '' || c.cust_last_name as x,
sum(o.order_total) as y
from demo_customers c, demo_orders o
where c.customer_id = o.customer_id
group by c.cust_first_name || '' '' || c.cust_last_name
union all
SELECT
''column 2'' column_name,
c.cust_first_name || '' '' || c.cust_last_name as x,
sum(o.order_total*1.21/rownum) as y
from demo_customers c, demo_orders o
where c.customer_id = o.customer_id
group by c.cust_first_name || '' '' || c.cust_last_name
order by 2
),
columns as (select ''column 1'' column_name from dual
union all
select ''column 2'' column_name from dual)
SELECT ''file1'' AS "filename",
CURSOR
(SELECT CURSOR
(SELECT ''line'' AS "type",
''My Multi-Series Line Chart'' AS "name",
CURSOR
(SELECT line_name AS "name",
CURSOR
(select link, x as "x", y as "y"
from both_lines bl
where bl.line_name = l.line_name
) AS "data"
FROM lines l
) AS "lines"
FROM dual
) AS "line_chart",
cursor(select
''column'' as "type",
''My Column Chart'' as "name",
cursor
(select
576 as "width" ,
336 as "height",
''Title'' as "title in chart" ,
''true'' as "grid" ,
''true'' as "border"
from dual
) as "options",
cursor(select
column_name as "name",
cursor
(select null as link, x as "x", y as "y"
from both_columns bl
where bl.column_name = l.column_name
) as "data"
from columns l
) as "columns"
from dual) as "column_chart"
FROM dual
) AS "data"
FROM dual
','aop_template_multiple_charts.pptx',null,null,null,null,to_date('02/09/16','DD/MM/RR'),to_date('06/09/16','DD/MM/RR'),232,25);
Insert into AOP_AUTOMATED_TEST (ID,DESCRIPTION,DATA_TYPE,TEMPLATE_TYPE,OUTPUT_TYPE,OUTPUT_FILENAME,EXPECTED_BYTES,RECEIVED_BYTES,RESULT,PROCESSING_SECONDS,SEQ_NR,DATA_SOURCE,TEMPLATE_SOURCE,OUTPUT_TYPE_ITEM_NAME,OUTPUT_TO,SPECIAL,PROCEDURE_,CREATED_DATE,RUN_DATE,APP_ID,PAGE_ID) values (79154343032777483648284863958681099572,'Page: 16: Print Column Chart (multi-serie) PDF','SQL','APEX','pdf','p16_output_column_chart_multi',64623,64623,'ok',2,42,'select
''file1'' as "filename",
cursor(select
cursor(select
c.cust_first_name || '' '' || c.cust_last_name as "customer",
c.cust_city as "city" ,
o.order_total as "total" ,
o.order_timestamp as "timestamp"
from demo_customers c, demo_orders o
where c.customer_id = o.customer_id
order by c.cust_first_name || '' '' || c.cust_last_name
) as "orders",
cursor(select
''column'' as "type",
''My Column Chart'' as "name",
cursor
(select
576 as "width" ,
336 as "height",
''Title'' as "title in chart" ,
''true'' as "grid" ,
''true'' as "border"
from dual
) as "options",
cursor(select
''column '' || to_char(nbr) as "name",
cursor
(select
c.cust_first_name || '' '' || c.cust_last_name as "x",
sum(o.order_total) * nbr as "y"
from demo_customers c, demo_orders o
where c.customer_id = o.customer_id
group by c.cust_first_name || '' '' || c.cust_last_name
order by c.cust_first_name || '' '' || c.cust_last_name
) as "data"
from (select 1 as nbr from dual union select 1.21 as nbr from dual)
) as "columns"
from dual) as "chart"
from dual) as "data"
from dual ','aop_template_chart_with_data.docx',null,null,null,null,to_date('02/09/16','DD/MM/RR'),to_date('06/09/16','DD/MM/RR'),232,16);
Insert into AOP_AUTOMATED_TEST (ID,DESCRIPTION,DATA_TYPE,TEMPLATE_TYPE,OUTPUT_TYPE,OUTPUT_FILENAME,EXPECTED_BYTES,RECEIVED_BYTES,RESULT,PROCESSING_SECONDS,SEQ_NR,DATA_SOURCE,TEMPLATE_SOURCE,OUTPUT_TYPE_ITEM_NAME,OUTPUT_TO,SPECIAL,PROCEDURE_,CREATED_DATE,RUN_DATE,APP_ID,PAGE_ID) values (79154343032778692574104478587855805748,'Page: 25: Print Column Chart (multi-serie) Docx','SQL','APEX','docx','p25_output_multiple_charts',86800,86800,'ok',0,43,'with both_lines as
(
SELECT
''line 1'' line_name,
NULL AS LINK,
rownum AS x,
o.order_total AS y
FROM demo_customers c,
demo_orders o
WHERE c.customer_id = o.customer_id
union all
SELECT
''line 2'' line_name,
NULL AS LINK,
rownum AS x,
o.order_total*1.21/rownum AS y
FROM demo_customers c,
demo_orders o
WHERE c.customer_id = o.customer_id
),
lines as (select ''line 1'' line_name from dual
union all
select ''line 2'' line_name from dual),
both_columns as
(
SELECT
''column 1'' column_name,
c.cust_first_name || '' '' || c.cust_last_name as x,
sum(o.order_total) as y
from demo_customers c, demo_orders o
where c.customer_id = o.customer_id
group by c.cust_first_name || '' '' || c.cust_last_name
union all
SELECT
''column 2'' column_name,
c.cust_first_name || '' '' || c.cust_last_name as x,
sum(o.order_total*1.21/rownum) as y
from demo_customers c, demo_orders o
where c.customer_id = o.customer_id
group by c.cust_first_name || '' '' || c.cust_last_name
order by 2
),
columns as (select ''column 1'' column_name from dual
union all
select ''column 2'' column_name from dual)
SELECT ''file1'' AS "filename",
CURSOR
(SELECT CURSOR
(SELECT ''line'' AS "type",
''My Multi-Series Line Chart'' AS "name",
CURSOR
(SELECT line_name AS "name",
CURSOR
(select link, x as "x", y as "y"
from both_lines bl
where bl.line_name = l.line_name
) AS "data"
FROM lines l
) AS "lines"
FROM dual
) AS "line_chart",
cursor(select
''column'' as "type",
''My Column Chart'' as "name",
cursor
(select
576 as "width" ,
336 as "height",
''Title'' as "title in chart" ,
''true'' as "grid" ,
''true'' as "border"
from dual
) as "options",
cursor(select
column_name as "name",
cursor
(select null as link, x as "x", y as "y"
from both_columns bl
where bl.column_name = l.column_name
) as "data"
from columns l
) as "columns"
from dual) as "column_chart"
FROM dual
) AS "data"
FROM dual
','aop_template_multiple_charts.docx',null,null,null,null,to_date('02/09/16','DD/MM/RR'),to_date('06/09/16','DD/MM/RR'),232,25);
commit;
Insert into AOP_TEMPLATE (ID,FILENAME,MIME_TYPE,LAST_UPDATE_DATE,TEMPLATE_TYPE,DESCRIPTION) values (1,'aop_template_d01.docx','application/vnd.openxmlformats-officedocument.wordprocessingml.document',to_date('26/06/15','DD/MM/RR'),'docx',null);
Insert into AOP_TEMPLATE (ID,FILENAME,MIME_TYPE,LAST_UPDATE_DATE,TEMPLATE_TYPE,DESCRIPTION) values (2,'aop_template_p01.pptx','application/vnd.openxmlformats-officedocument.presentationml.presentation',to_date('26/06/15','DD/MM/RR'),'pptx',null);
Insert into AOP_TEMPLATE (ID,FILENAME,MIME_TYPE,LAST_UPDATE_DATE,TEMPLATE_TYPE,DESCRIPTION) values (3,'aop_template_x01.xlsx','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',to_date('09/12/15','DD/MM/RR'),'xlsx',null);
Insert into AOP_TEMPLATE (ID,FILENAME,MIME_TYPE,LAST_UPDATE_DATE,TEMPLATE_TYPE,DESCRIPTION) values (4,'aop_template_p02.pptx','application/vnd.openxmlformats-officedocument.presentationml.presentation',to_date('02/08/15','DD/MM/RR'),'pptx',null);
Insert into AOP_TEMPLATE (ID,FILENAME,MIME_TYPE,LAST_UPDATE_DATE,TEMPLATE_TYPE,DESCRIPTION) values (5,'aop_template_p03.pptx','application/vnd.openxmlformats-officedocument.presentationml.presentation',to_date('02/08/15','DD/MM/RR'),'pptx',null);
commit;
update aop_template t
set t.template_blob = (select a.blob_content
from apex_application_files a
where a.filename = t.filename
and rownum < 2
)
where t.template_blob is null;
commit;