Loop through array
-
set serveroutput on;
-
declare
-
TYPE t_queues IS TABLE OF VARCHAR2(255) INDEX BY PLS_INTEGER;
-
l_queues t_queues;
-
l_c number;
-
begin
-
dbms_output.put_line('Start');
-
-
l_queues(1) := 'IC_SOA_PSAO_STUDENT_INone';
-
l_queues(2) := 'IC_SOA_PSAO_STUDENT_INtwo';
-
l_queues(3) := 'IC_SOA_PSAO_STUDENT_INthree';
-
l_queues(4) := 'IC_SOA_PSAO_STUDENT_INfour';
-
-
FOR l_c IN 1..l_queues.COUNT LOOP
-
NULL;
-
dbms_output.put_line('Test:' || to_char(l_c) || ':' || l_queues(l_c));
-
END LOOP;
-
-
dbms_output.put_line('End');
-
end;
Loop through Array indexed by varchar2
-
set serveroutput on;
-
declare
-
TYPE t_namespaces IS TABLE OF varchar2(4096) INDEX BY VARCHAR2(255);
-
g_knownNamespaces t_namespaces;
-
-
l_key varchar2(255);
-
begin
-
dbms_output.put_line('Start');
-
-
g_knownNamespaces('ddf') := 'dsad';
-
g_knownNamespaces('swr') := 'rethbg';
-
-
-
l_key := g_knownNamespaces.first;
-
loop
-
exit when l_key is null;
-
dbms_output.put_line('xmlns:' || l_key || '="' || g_knownNamespaces(l_key) || '" ');
-
l_key := g_knownNamespaces.next(l_key);
-
end loop;
-
-
dbms_output.put_line('End');
-
end;
Cursor Loop
-
SET VERIFY OFF;
-
-
set serveroutput on;
-
-
--insert into statement
-
declare
-
cursor cols_c is
-
select table_name, owner, column_name, data_type
-
from all_tab_columns
-
where table_name = 'RA_INT_LINES_ALL_CP'
-
;
-
l_rec cols_c%rowtype;
-
begin
-
dbms_output.put_line('Start');
-
-
for l_rec in cols_c loop
-
dbms_output.put_line(l_rec.column_name);
-
end loop;
-
-
dbms_output.put_line('End');
-
-
end;
Cursor loop with bulk collect
-
procedure StopSOA(p_stop in boolean)
-
is
-
cursor c_queues is
-
select
-
uq.name,
-
uq.dequeue_enabled
-
from user_queues uq
-
where uq.queue_table='IC_SOA_JMS_QTAB'
-
and name not like 'AQ$%';
-
TYPE t_queues IS TABLE OF c_queues%ROWTYPE INDEX BY PLS_INTEGER;
-
l_queues t_queues;
-
-
l_cur number;
-
begin
-
open c_queues;
-
fetch c_queues bulk collect into l_queues;
-
close c_queues;
-
-
-
l_cur := l_queues.FIRST;
-
while (l_cur is not null) LOOP
-
dbms_output.put_line(l_queues(l_cur).name);
-
l_cur := l_queues.NEXT(l_cur);
-
END LOOP; --Loop through messages
-
-
end;
RJM Article Type
Quick Reference