Q:

Iterating through fields of a rowtype variable

I selected a row from table some_table into a rowtype variable l_current. Now I would like to iterate through fields in that variable from first to last and get field name and value.
In the code snippet below I wrote in commented out part what I would like to do with plsql, but can't find how to do it.
declare
    l_current   some_table%rowtype;
begin
    for i in l_records.first .. l_records.last 
    loop
      select *
        into l_current
        from some_table
       where id = l_records(i).id;
--*******************
       for each field in l_current
       loop
         a := field.name;
         b := field.value;
       end loop;
--*******************
    end loop;
end;

A:

So after a bit of research i've managed to accomplish what i wanted, but in quite different way using DBMS_SQL package. Here is a snippet from a working example :
      l_sql := '';
      l_sql := l_sql || 'select * ';
      l_sql := l_sql || '  from some_table where id = ' || l_records(i).ekd_id;

      l_cursorID := DBMS_SQL.OPEN_CURSOR;
      dbms_sql.parse( l_cursorID, l_sql, dbms_sql.native );
      dbms_sql.describe_columns( l_cursorID, l_column_count, l_descTbl );

      for j in 1..l_column_count
      loop
        dbms_sql.define_column( l_cursorID, j, l_columnValue, 2000 );
        l_key := l_descTbl(j).col_name;
        l_table(j + (l_counter * l_column_count)).kre_id := l_records(i).kre_id; --i + (l_counter * l_column_count)
        l_table(j + (l_counter * l_column_count)).field_id := j;
        l_table(j + (l_counter * l_column_count)).field_name := l_key;
      end loop;

      l_status := dbms_sql.execute(l_cursorID);
      l_status := DBMS_SQL.FETCH_ROWS(l_cursorID);

      for k in 1..l_column_count
      loop
        dbms_sql.column_value( l_cursorID, k, l_columnValue );
        l_value := l_columnValue;
        l_table(k + (l_counter * l_column_count)).field_value1 := l_value;
      end loop;

      DBMS_SQL.CLOSE_CURSOR(l_cursorID);

Hopefully someone will find this usefull.

