Essa é a query que fiz no reports para geração do realtorio:
select id_questao, rownum||' - '||dsc_questao
from( select q.id_questao id_questao, q.dsc_questao dsc_questao
from questao q, assunto a
where q.id_assunto = a.id_assunto
and q.ind_nivel = 1
and q.id_assunto in :PASSUNTO
order by dbms_random.value ), dual
where rownum <= 10
DECLARE
PLIST PARAMLIST;
PL_NAME VARCHAR2(15) := 'PL';
ASSUNTO VARCHAR2(1000);
WRK_CONT NUMBER := 0;
BEGIN
Go_block('BLC_ASSUNTO');
first_record;
loop
if :BLC_ASSUNTO.CHECK_BOX_ASSUNTO = 'S' then
if WRK_CONT = 0 then
ASSUNTO := :blc_assunto.id_assunto;
wrk_cont := wrk_cont +1;
else
ASSUNTO := assunto||' , '|| + :blc_assunto.id_assunto;
end if;
end if;
IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
EXIT;
ELSE
NEXT_RECORD;
END IF;
END LOOP;
PLIST := GET_PARAMETER_LIST(PL_NAME);
IF ID_NULL(PLIST) THEN
PLIST := CREATE_PARAMETER_LIST(PL_NAME);
ADD_PARAMETER(PLIST, 'PCURSO', TEXT_PARAMETER, ASSUNTO);
RUN_PRODUCT(REPORTS, 'C:\PL.rdf', SYNCHRONOUS, RUNTIME, FILESYSTEM, PLIST, NULL);
obg.