Mount a table of records from a Collection in PL-SQL

Asked

Viewed 19 times

1

Long live,

I have a Collection with records like this:

TYPE TABLE_RECORD IS RECORD (n_lin number, n_col number, val varchar(4000)); TYPE TABLE_CHUNK IS TABLE OF TABLE_RECORD;

Let’s say I have these records inside:

-- 1 0 DATE -- 1 1 UGW -- 1 2 500

-- 2 0 DATE -- 2 1 Test -- 2 2 100

The first is the row number, the second the column number and the third the value.

I want to traverse the entire Collection loop and mount the body of a table in html:

v_col_index2 := 2;

       htp.p( ' <tr>');
         
         FOR j IN 1..l_columns_data.COUNT LOOP
         
         if l_columns_data(j).n_col = 0 then
          htp.p('  <td> '||l_columns_data(j).val||'</td>');
          end if;
           
          
           
        for l in 1..v_col_index2  loop
          
             if l_columns_data(j).n_col = l then
          htp.p('   <td> '||l_columns_data(j).val||'</td>');
          
          end if;
          
           end loop;
         
            
        htp.p('</tr>');
       
        end loop;

The goal is that every 3 Collection records that have the number 1 creates a record in table "tr" and then according to the column creates a "td" with the associated value.

Do you think it’s possible?

Thank you very much.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.