forked from oleksiivorobiov/oracle_oci_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aqdemo11.sql
65 lines (55 loc) · 1.58 KB
/
aqdemo11.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
Rem
Rem $Header: aqdemo11.sql 17-oct-2003.16:57:17 aahluwal Exp $
Rem
Rem aqdemo11.sql
Rem
Rem Copyright (c) 2003, Oracle Corporation. All rights reserved.
Rem
Rem NAME
Rem aqdemo11.sql - <one-line expansion of the name>
Rem
Rem DESCRIPTION
Rem Performs an array deq of a batch of messages from my_queue
Rem
Rem NOTES
Rem <other useful comments, qualifications, etc.>
Rem
Rem MODIFIED (MM/DD/YY)
Rem aahluwal 10/17/03 - aahluwal_create_arrenqdeq_demos
Rem aahluwal 10/07/03 - Created
Rem
SET ECHO ON
SET FEEDBACK 1
SET NUMWIDTH 10
SET LINESIZE 80
SET TRIMSPOOL ON
SET TAB OFF
SET PAGESIZE 100
Rem perform array dequeue from AQ queue my_queue
connect aquser/aquser
set serveroutput on
set echo on
DECLARE
deqopt dbms_aq.dequeue_options_t ;
msgproparr dbms_aq.message_properties_array_t :=
dbms_aq.message_properties_array_t();
payloadarr message_arr := message_arr() ;
msgidarr dbms_aq.msgid_array_t ;
retval pls_integer ;
BEGIN
payloadarr.extend(10);
msgproparr.extend(10);
deqopt.consumer_name := 'SUB1';
retval := dbms_aq.dequeue_array( queue_name => 'AQUSER.MY_QUEUE',
dequeue_options => deqopt ,
array_size => payloadarr.count,
message_properties_array => msgproparr,
payload_array => payloadarr,
msgid_array => msgidarr ) ;
commit;
dbms_output.put_line('Dequeued ' || retval || ' messages') ;
for i in 1..retval loop
dbms_output.put_line ('Message ' || i || ' payload: ' || payloadarr(i).data) ;
end loop ;
END;
/