Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Location
    Lithuania
    Posts
    4

    Unanswered: How to create html form using loop?

    Hello

    Maybe someone has faced such a problem?

    It's simple to create html form, when a table has few fields. But there are more than 200 fields in my tables! So, a way like below becomes unpleasant .

    CREATE OR REPLACE PROCEDURE pr_name
    (
    id1 in varchar2 default null,
    id2 in char default null
    )
    IS
    begin
    <...>
    htp.bodyopen;
    htp.p('<FORM>');
    htp.tableOpen;
    htp.p(' <TR><TD>NAME=id1 VALUE='||id1||'></TD>
    <TD>NAME=id2 VALUE='||id2||'></TD></TR> ');
    htp.bodyclose;
    <...>
    end;
    /

    I had an idea to put this : <TD>NAME=id1 VALUE='||id1||'>
    in the loop. But then i cannot find how to define VALUE!

    of course, i can put the name of parameters in varray. So, NAME it's not a problem longer: NAME=my_varray(i). But the VALUE is still a headache!

    I will appreciate any suggestion.
    Thanks.

  2. #2
    Join Date
    Sep 2003
    Location
    Brussel
    Posts
    52

    Re: How to create html form using loop?

    Make use of the possibilitys of cursors. Read the data from your table into a cursor and then loop the cursor. There's a specific cursorloop (a kind of for loop). Something like ...

    CURSOR <cursorname> IS
    SELECT <blabla>
    FROM <blabla>;

    put the cursor in the DECLARE part of the code. Now you can loop the cursor like this:

    FOR <name> IN <cursorname> LOOP
    htp.print( <name>.<column selected in table>);
    END LOOP;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •