Hi, I'm using DBMS to generate cursors and the output to htp using pl/sql.
Basically, I have a table of questions, eg:
id, q1a, q2a, q2b, q3, etc
and I'm displaying this on the web. It draws it in a table like this:
--variable = question name stuff here
-- parsing the dbms here
-- defining the columns here
loop
if dbms_sql.fetch_rows (c1) > 0 then
-- column value stuff here
htp.print('<tr>');
htp.print('<td>' || v_question || '</td>');
htp.print('</tr>');
else
exit;
end if;
end loop;
Because the select is fairly complex (using some decodes etc) I'm using DBMS_SQL so I can set the question name on the fly to a variable. However, It would be great if I could reuse the cursor every question, as opposed to having to define the columns (there's 7 of them) etc everytime I want to do it.
Any ideas? cheers
Basically, I have a table of questions, eg:
id, q1a, q2a, q2b, q3, etc
and I'm displaying this on the web. It draws it in a table like this:
--variable = question name stuff here
-- parsing the dbms here
-- defining the columns here
loop
if dbms_sql.fetch_rows (c1) > 0 then
-- column value stuff here
htp.print('<tr>');
htp.print('<td>' || v_question || '</td>');
htp.print('</tr>');
else
exit;
end if;
end loop;
Because the select is fairly complex (using some decodes etc) I'm using DBMS_SQL so I can set the question name on the fly to a variable. However, It would be great if I could reuse the cursor every question, as opposed to having to define the columns (there's 7 of them) etc everytime I want to do it.
Any ideas? cheers