Need a query to do row to column transformation

SELECT friday_date FROM t2;Table Data:
1/2/2009
1/9/2009
1/16/2009.......
I need a query to get the output in below fashion
Column
1/2/2009,1/9/2009,1/16/2009
I tried PIVOT and TRANSPOSE, cannot do this. I believe because it is a date,may be.
I tried below code also, but CONNECT_BY_ISLEAF wont work on "ORA-00904: "CONNECT_BY_ISLEAF": invalid identifier"
SELECT ltrim(sys_connect_by_path(FRIDAY_DATE,','),',') FRIDAY_DATE
       FROM (
        SELECT row_number() OVER(ORDER BY FRIDAY_DATE) rno,
               FRIDAY_DATE
          FROM t2
      WHERE CONNECT_BY_ISLEAF = '1'
      start WITH rno = '1'
    connect BY rno = PRIOR rno+1;Thank You

SQL>  WITH t2 AS (      SELECT TO_CHAR (
                                          NEXT_DAY (
                                               DATE '2009-01-01' + (LEVEL - 1) * 7,
                                               'friday'
                                          'mm/dd/yyyy'
                                          friday_date
                              FROM DUAL
                    CONNECT BY LEVEL <= (DATE '2009-12-31' - DATE '2009-01-01') / 7)
SELECT RTRIM (
                XMLAGG (XMLELEMENT (
                                   e,
                                   friday_date || ','
                              )).EXTRACT ('//text()'),
                COLUMN_VALUE
  FROM t2
COLUMN_VALUE                                                                   
01/02/2009,01/09/2009,01/16/2009,01/23/2009,01/30/2009,02/06/2009,02/13/2009,02/
20/2009,02/27/2009,03/06/2009,03/13/2009,03/20/2009,03/27/2009,04/03/2009,04/10/
2009,04/17/2009,04/24/2009,05/01/2009,05/08/2009,05/15/2009,05/22/2009,05/29/200
9,06/05/2009,06/12/2009,06/19/2009,06/26/2009,07/03/2009,07/10/2009,07/17/2009,0
7/24/2009,07/31/2009,08/07/2009,08/14/2009,08/21/2009,08/28/2009,09/04/2009,09/1
1/2009,09/18/2009,09/25/2009,10/02/2009,10/09/2009,10/16/2009,10/23/2009,10/30/2
009,11/06/2009,11/13/2009,11/20/2009,11/27/2009,12/04/2009,12/11/2009,12/18/2009
,12/25/2009                                                                    
1 row selected.

Similar Messages

  • Need sql query to convert rows to columns

    Im using oracle 11g.
    I have data in a table as below: Column names are type,month,percentage
    TYPE      MONTH   PERCENTAGE
    A1         JAN-2013     100
    A2         JAN-2013     100
    A3         JAN-2013     95
    A4         JAN-2013     98
    A5         JAN-2013     99
    A6         JAN-2013     90
    A7         JAN-2013     92
    A1         FEB-2013     100
    A2         FEB-2013     99
    A3         FEB-2013     88
    A4         FEB-2013     67
    A5         FEB-2013     98
    A6         FEB-2013     95
    A7         FEB-2013     84
    The desired output using a sql query is as below
    TYPE     JAN-2013     FEB-2013
    A1         100             100
    A2         100             99
    A3         95               88
    A4         98               67
    A5         99               98
    A6         90               95
    A7         92               84

    Try this:
    select * from table_name
    PIVOT(   max(Percentage)
                     for MONTH
                     in ('JAN-2013','FEB-2013')
                     ) ;with data
    with t(TYPE,MONTH,PERCENTAGE) as
    SELECT 'A1', 'JAN-2013', 100
      FROM DUAL
    UNION ALL
    SELECT 'A2', 'JAN-2013', 100
      FROM DUAL
    UNION ALL
    SELECT 'A3', 'JAN-2013', 95
      FROM DUAL
    UNION ALL
    SELECT 'A4', 'JAN-2013', 98
      FROM DUAL
    UNION ALL
    SELECT 'A1', 'FEB-2013', 100
      FROM DUAL
    UNION ALL
    SELECT 'A2', 'FEB-2013', 99
      FROM DUAL
    UNION ALL
    SELECT 'A3', 'FEB-2013', 88
      FROM DUAL
    UNION ALL
    SELECT 'A4', 'FEB-2013', 67
      FROM DUAL
    select * from t PIVOT(   max(Percentage)
                     for MONTH
                     in ('JAN-2013','FEB-2013')
                     ) ;

  • Query to convert Row to column - Re-posting

    Hi all,
    i am re-posting the same requirement, please do the needful.
    I need a query to convert row value into column delimited by ','
    create table tb_row_2_col (id number,val varchar2(100));
    insert into tb_row_2_col values (1,'col1');
    insert into tb_row_2_col values (1,'col2');
    insert into tb_row_2_col values (1,'col3');
    insert into tb_row_2_col values (2,'col4');
    insert into tb_row_2_col values (2,'col5');
    commit;
    SQL> select * from tb_row_2_col;
    ID VAL
    1 col1
    1 col2
    1 col3
    2 col4
    2 col5
    SQL>
    if i execute a query the output should be like this
    ID VAL
    1 col1,col2,col3
    2 col4,col5
    Thanks in advance
    S. Sathish Kumar

    Most repeated question in the forum..
    SQL> select id,max(ltrim(sys_connect_by_path(val,','),',')) res
      2  from (select id,val,
      3           row_number() over(partition by id order by val) rn
      4        from tb_row_2_col)
      5  start with rn = 1
      6  connect by prior rn = rn -1
      7          and prior id = id
      8  group by id;
            ID RES
             1 col1,col2,col3
             2 col4,col5<br>
    Message was edited by:
    jeneesh
    Check here for variations..

  • Query to convert Row to column

    Hi all,
    I need a query to convert row value into column delimited by ','
    create table tb_row_2_col (id number,val varchar2(100));
    insert into tb_row_2_col values (1,'col1');
    insert into tb_row_2_col values (1,'col2');
    insert into tb_row_2_col values (1,'col3');
    insert into tb_row_2_col values (2,'col4');
    insert into tb_row_2_col values (2,'col5');
    commit;
    SQL> select * from tb_row_2_col;
    ID VAL
    1 col1
    1 col2
    1 col3
    2 col4
    2 col5
    SQL>
    if i execute a query the output should be like this
    ID VAL
    1 col1,col2,col3
    2 col4,col5
    Thanks in advance
    S. Sathish Kumar

    Or look for aggregation techniques against the forum helping by the search feature (top-right of the current page).
    Nicolas.

  • Query to delete row where column value contains alphabets

    Hi,
    Could anyone please help me to get this query work.
    Query to delete row where column value contains alphabets.
    DELETE  FROM BIN_ITEM WHERE order_nmb LIKE '%[A-Z]%' || LIKE '%[a-z]%'
    Thanks and Regards,
    Deekay.

    RaminHashimzadeh wrote:
    SELECT order_nmb FROM BIN_ITEM WHERE regexp_count(order_nmb,'[0-9]') = 0
    Ramin Hashimzade
    But that won't reject strings like 'gfgG%dgh' which aren't pure alphabetic.
    Try:
    with test_data as (
    select 'ghTYJYEhdfe' str from dual
    union
    select 'dfF5ssd' from dual
    union
    select 'rgth*dgheh' from dual
    union
    select 'ggf{' from dual
    union
    select 'rwhrhrh' from dual
    select  *
    from test_data
    where regexp_instr(str,'[^[:alpha:]]')=0;

  • [Oracle 8i] Query for N rows by column value?

    I was just wondering if what I want to do is possible within my query (rather than programmatically)...
    I want to return the N most recent records for each unique value in a particular column.
    Here's a sample table:
    CREATE TABLE     orders
    (     order_no     numeric(10)
         part_no          varchar(5)
         close_date     date
         order_qty     numeric(10)
         scrap_qty     numeric(10)
         CONSTRAINT order_pk PRIMARY KEY (order_no)
    );And some sample data....
    INSERT INTO     orders     VALUES
    (0000012345,'ABC-1',TO_DATE('01-01-2010','mm-dd-yyyy'),10,1);
    INSERT INTO     orders     VALUES
    (0000013498,'ABC-1',TO_DATE('01-05-2010','mm-dd-yyyy'),12,2);
    INSERT INTO     orders     VALUES
    (0000033452,'ABC-1',TO_DATE('01-10-2010','mm-dd-yyyy'),5,0);
    INSERT INTO     orders     VALUES
    (0000001468,'ABC-1',TO_DATE('01-15-2010','mm-dd-yyyy'),15,1);
    INSERT INTO     orders     VALUES
    (0000022349,'BR723',TO_DATE('01-03-2010','mm-dd-yyyy'),8,1);
    INSERT INTO     orders     VALUES
    (0000069581,'BR723',TO_DATE('01-05-2010','mm-dd-yyyy'),5,0);
    INSERT INTO     orders     VALUES
    (0000436721,'BR723',TO_DATE('01-10-2010','mm-dd-yyyy'),14,1);
    INSERT INTO     orders     VALUES
    (0000213446,'A5001',TO_DATE('01-06-2010','mm-dd-yyyy'),5,1);
    INSERT INTO     orders     VALUES
    (0000327987,'A5001',TO_DATE('01-08-2010','mm-dd-yyyy'),5,0);
    INSERT INTO     orders     VALUES
    (0000041353,'A5001',TO_DATE('01-14-2010','mm-dd-yyyy'),12,1);
    INSERT INTO     orders     VALUES
    (0000011241,'A5001',TO_DATE('01-15-2010','mm-dd-yyyy'),5,1);In this example, what I want to return are the 2 most recent orders (by close_date) for each part number.
    Here is a table with the results I want to get, based on the scenario above:
    order_no     part_no          close_date     order_qty     scrap_qty
    0000001468     'ABC-1'          '01-15-2010'     15          1
    0000033452     'ABC-1'          '01-10-2010'     5          0
    0000436721     'BR723'          '01-10-2010'     14          1
    0000069581     'BR723'          '01-05-2010'     5          0
    0000011241     'A5001'          '01-15-2010'     5          1
    0000041353     'A5001'          '01-14-2010'     12          1Is it possible to write a query to get these results, or am I going to have to query for all available data, and find the 2 most recent rows programmatically?
    Thanks in advance!

    Hi,
    user11033437 wrote:
    I'm going to test that out right now. I think if it works, I may need to use dense_rank() rather than rank(), because it is possible that two orders for the same part number could have the same close date, and according to what I've looked up on the rank() and dense_rank() functions, rank() can give non-consecutive results if the values are the same.What's wrong with non-consecutive values?
    Use RANK, DENSE_RANK or ROW_NUMBER depending on what you want.
    For example; say a certain part has been ordered 8 times:
    3 times with close_date January 29, 2010 (all at exactly the same time),
    4 times with close_date January 28, 2010 (all at exactly the same time), and
    1 time with close_date January 27, 2010.
    If you ask for the last 2 rows:
    RANK will give you the 3 rows from January 29. (All 3 have an equal claim to being in the top 2.)
    DENSE_RANK will give you the 7 rows from January 28-29 (the last two values , regardless of how many rows have them).
    ROW_NUMBER will give you 2 rows from January 29. (Which 2? It's arbitrary unless you add a tie-breaker to the ORDER BY clause.)
    All these functions are available in Oracle 8.1.

  • Need help in solving conversion row to columns issue

    Hi friends
    I came across a strange situation/ problem. The problem is in one table say source_metadata
    I have 4 attribute
    matching_Table matching_columns source_table source_col
    OTREDW.PARTY_ALT_ID Src_key rcw Source_key
    OTREDW.PARTY_ALT_ID party_id rcw party_id_org
    otredw.individual SRC_KEY
    otredw.individual name rcw name_org
    otredw.individual name rcw name_mod
    otredw.wage_fact src_key
    otredw.wage_fact wages_tips rcw wage_tips_org
    otredw.wage_fact wages_tips rcw wage_tips_mod
    The matching tables and source table can be matched on src_key/source_key
    I need to fetch the values from the respective tables / columns in one query. I have just faint idea to the solution is use of PIVOT feature.
    The desired OUTPUT is
    PARTY_ID PARTY_ID_ORG Name name_org name_mod wages_tips wages_tips_org wages_tips_mod
    1111111 1111111 James James JamesR 1000 1000 2000
    I hope I have explained what I need. I will appreciate If anyone will be able to show me the way how to resolve this issue.
    Thanks
    Rajesh

    Thanks everone for sending me the answer but I think I am unable to explain my issue.
    The main issue is I am storing the name of the table and name of the corresponding column of the table under different columns of the table. How to fetch the data using a sql from these columns.
    EXAMPLE
    METADATA_TABLE
    table_name Column_name
    OTREDW.PARTY_ALT_ID PARTY_ID
    OTREDW.INDIVIDUAL NAME
    OTREDW.WAGE_FACT WAGES_TIPS
    How to write query to fetch the table_name and column_name from metadata_table and fetch the data from the respective tables mentioned in the table columns?
    I hope I was able to explain the question now.
    Thanks
    Rajesh

  • Need to display my table rows as columns (have tried lots, still no luck)

    My data is as follows:
    attribute_name attribute_value
    VisitType Housing
    Priority 1
    I need it to come out in this format:
    VisitType Priority
    Housing 1
    It's set up this way to make some of the fields user definable. Therefore, VisitType is defined by the user and isn't set in stone.
    I don't like this model but I'm stuck with it. Have tried a few things but nothing works!!
    please help.

    may be this could help.
    Create table Att_tab (
    Attribute_name varchar2(30),
    Attribute_type varchar2(30))
    Insert into Att_tab
    Select 'VisitType', 'Housing' from dual
    union all
    Select  'Priority', '1' from dual;
    Select * from Att_tab;
    SELECT srno,
    LTRIM(MAX(SYS_CONNECT_BY_PATH(Attribute_name,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS Attribute_name,
    LTRIM(MAX(SYS_CONNECT_BY_PATH(Attribute_type,',')) KEEP (DENSE_RANK LAST ORDER BY curr),',') AS Attribute_type
    FROM (SELECT 1 srno,
    Attribute_type,
    ATTRIBUTE_NAME,
    ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY Attribute_type) AS curr,
    ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY Attribute_type) -1 AS prev
    FROM Att_tab)
    GROUP BY srno
    CONNECT BY prev = PRIOR curr AND srno = PRIOR srno
    START WITH curr = 1;

  • Oracle row to column transformation

    RDBMS :10.2
    Hi,
    I have a query that composed of there tables and have joins in them. The final result query is giving is as folllow
    ProductId ComProductId description
    055X     035X     Ladies Companion
    055X     055X     Adult Companion
    112008     112009     Large Companion
    112008     112008     Medium Companion
    112009     112009     Medium Companion
    112009     112008     Large Companion
    I want to transform the output in following way, so every product may have its comProductID + Description in single row e.g. Product -ComProductId1 description1 ComProductId2 description2 .....
    ProductId ComProductId description ComProductId description
    055X     035X     Ladies Companion 055X     Adult Companion
    112008     112009     Large Companion 112008     Medium Companion
    Do we have any built in function or way to achieve this goal ?

    thank you Hoek. it was really great to read. But as per post, i need to use "dynamic Pivot" but it is in 11g and i am using 10 g :(
    Following query I am using to get results and that query I wan to transform
    SELECT mainitem.productid as ProductId,
    compitem.productid as ComProductId,
    comp.header as description
    FROM comp
    JOIN item mainitem ON comp.Id = mainitem.id
    JOIN item compitem ON comp.Companion = compitem.id;
    this query produce following results
    ProductId ComProductId description
    055X 035X Ladies Companion
    055X 055X Adult Companion
    112008 112009 Large Companion
    112008 112008 Medium Companion
    112009 112009 Medium Companion
    112009 112008 Large Companion
    I want to transform the output in following way, so every product may have its comProductID + Description in single row e.g. Product -ComProductId1 description1 ComProductId2 description2 .....
    ProductId ComProductId description ComProductId description
    055X 035X Ladies Companion 055X Adult Companion
    112008 112009 Large Companion 112008 Medium Companion
    thanks

  • Row to Column transformation on an update form

    I'm trying to create an updateable HTML-DB application that does the following. Any idea, the best way to do this?
    Converts table rows into HTML-DB columns.
    Create table INV_ORDERS
    (Month date,
    Beg_Inv number,
    Planned_orders number
    select * from INV_ORDERS;
    Month Beg_Inv Planned_Orders
    NOV-2005 10 20
    DEC-2005 30 40
    JAN-2006 50 60
    How can I pivot it to be:
    NOV-2005 DEC-2006 JAN-2006
    Beg_Inv 10 30 50
    Planned_Orders 20 40 60
    The pivot numbers need to be updatable (via HTML-DB).
    Thank you.

    As it stands, your problem definition is quite "hard". Each column in the HTML DB tabular form belongs to a different physical row. You could try creating the tabular form off of a view that does the pivot and writing a INSTEAD OF trigger on that view, but it is not going to be easy.
    But why?
    What problem are you trying to solve, maybe we can suggest a different approach?

  • Row to Column Transformation for Millions of records

    Hi Members,
    I need to transform data from two stage tables which has data in PIM structure (data stored as separate records ) to target table which has a flat structure (data stored in a single record). One of the stg tables has data volume of 45M and other has 5M records.The challenge I am seeing here is to transform such huge data into single table with considerable performance.What would be the ideal way to transform such huge data?Also can we have multiple programs running at the same time to achieve transformation for such huge data load quicker?
    Just to add my Oracle Version is 10g.
    Thanks
    Edited by: Sonic on Jul 12, 2010 1:33 AM

    Still no version number, still no code, and no explain plan report.
    Is there a better, faster way to do it?, I don't know ... how could I or anyone else as you've not told us what you are doing beyond the level of "my car won't start tell me why?"
    This should help you understand the issue from my keyboard.
    http://www.builderau.com.au/strategy/developmentprocess/soa/How-developers-should-ask-for-help/0,339028278,339299138,00.htm

  • Apex 3.0 to 3.2, Updateable Reports & Row Selector Column?

    Good afternoon,
    (I searched the forum for both of these topics but didn't find an answer, it may be there and I missed it. If so, just point me in the right direction if you don't mind.)
    We just upgraded from 3.0.1.00.07 to 3.2.0.00.27.
    In 3.0 there was the option to select 'SQL Query (updateable report)' as a report type. I don't see that available now. What am I doing wrong?
    Also in 3.0, I would add a Row Selector column to a report by selecting 'SQL Query (updateable report)' as a report type, then clicking Row Selector in a side region to the right to add a row selector column, then I would change the report type back to SQL Query and the row selector column would remain. In 3.2 how do I get a row selector column added to a report?
    Thx, Tony

    But, yes, it can be installed with Forms & Reports Standalone. The http server with F&R ships with modplsql; that's all you need. Just configure a DAD as described in the documentation for setting it up with App Server.
    Anton

  • Same old question  (rows to columns using pl/sql)

    Hi all,
    i am re-posting the same requirement, please do the needful.
    I need a query to convert row value into column delimited by space.
    Dont need any column names just values.
    create table tb_row_2_col (id number,val varchar2(100));
    insert into tb_row_2_col values (1,'col1');
    insert into tb_row_2_col values (1,'col2');
    insert into tb_row_2_col values (1,'col3');
    insert into tb_row_2_col values (2,'col4');
    insert into tb_row_2_col values (2,'col5');
    commit;
    SQL> select * from tb_row_2_col;
    ID VAL
    1 col1
    1 col2
    1 col3
    2 col4
    2 col5
    SQL>
    if i execute a query the output should be like this. Please dont used decode/case.
    need to use loop to do the needful.
    1 col1 col2 col3
    2 col4 col5
    Priya.

    I doubted PL/SQL will be much faster, bjut here it goes:
    declare
        v_id number;
        v_prev_id number;
        v_val varchar2(100);
        v_combined_val varchar2(4000);
        cursor v_cur is select id,val from tb_row_2_col order by id,val;
    begin
        open v_cur;
        fetch v_cur into v_prev_id,v_combined_val;
        loop
          fetch v_cur into v_id,v_val;
          exit when v_cur%notfound;
          if v_id = v_prev_id
            then
              v_combined_val := v_combined_val || ' ' || v_val;
            else
              dbms_output.put_line(rpad(v_prev_id,5) || v_combined_val);
              v_prev_id := v_id;
              v_combined_val := v_val;
          end if;
        end loop;
        dbms_output.put_line(rpad(v_prev_id,5) || v_combined_val);
        close v_cur;
    end;
    1    col1 col2 col3
    2    col4 col5
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How to freeze row and column in JTable

    Hi,
    I need to freeze first two rows and columns in a large JTable. I found ways to freeze either a row or a column, but not both at the same time.
    Can any of you help ?
    Found this code which allows freezing a col. Similar method can be used to freeze column
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JViewport;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableModel;
    public class FrozenTablePane extends JScrollPane{
    public FrozenTablePane(JTable table, int colsToFreeze){
    super(table);
    TableModel model = table.getModel();
    //create a frozen model
    TableModel frozenModel = new DefaultTableModel(
    model.getRowCount(),
    colsToFreeze);
    //populate the frozen model
    for (int i = 0; i < model.getRowCount(); i++) {
    for (int j = 0; j < colsToFreeze; j++) {
    String value = (String) model.getValueAt(i, j);
    frozenModel.setValueAt(value, i, j);
    //create frozen table
    JTable frozenTable = new JTable(frozenModel);
    //remove the frozen columns from the original table
    for (int j = 0; j < colsToFreeze; j++) {
    table.removeColumn(table.getColumnModel().getColumn(0));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //format the frozen table
    JTableHeader header = table.getTableHeader();
    frozenTable.setBackground(header.getBackground());
    frozenTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    frozenTable.setEnabled(false);
    //set frozen table as row header view
    JViewport viewport = new JViewport();
    viewport.setView(frozenTable);
    viewport.setPreferredSize(frozenTable.getPreferredSize());
    setRowHeaderView(viewport);
    setCorner(JScrollPane.UPPER_LEFT_CORNER, frozenTable.getTableHeader());
    }

    Hi,
    I need to freeze first two rows and columns in a large JTable. I found ways to freeze either a row or a column, but not both at the same time.
    Can any of you help ?
    Found this code which allows freezing a col. Similar method can be used to freeze column
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JViewport;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.JTableHeader;
    import javax.swing.table.TableModel;
    public class FrozenTablePane extends JScrollPane{
    public FrozenTablePane(JTable table, int colsToFreeze){
    super(table);
    TableModel model = table.getModel();
    //create a frozen model
    TableModel frozenModel = new DefaultTableModel(
    model.getRowCount(),
    colsToFreeze);
    //populate the frozen model
    for (int i = 0; i < model.getRowCount(); i++) {
    for (int j = 0; j < colsToFreeze; j++) {
    String value = (String) model.getValueAt(i, j);
    frozenModel.setValueAt(value, i, j);
    //create frozen table
    JTable frozenTable = new JTable(frozenModel);
    //remove the frozen columns from the original table
    for (int j = 0; j < colsToFreeze; j++) {
    table.removeColumn(table.getColumnModel().getColumn(0));
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //format the frozen table
    JTableHeader header = table.getTableHeader();
    frozenTable.setBackground(header.getBackground());
    frozenTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    frozenTable.setEnabled(false);
    //set frozen table as row header view
    JViewport viewport = new JViewport();
    viewport.setView(frozenTable);
    viewport.setPreferredSize(frozenTable.getPreferredSize());
    setRowHeaderView(viewport);
    setCorner(JScrollPane.UPPER_LEFT_CORNER, frozenTable.getTableHeader());
    }

  • Referring to Cursor Row and Column in Dynamic SQL

    I have a procedure that dynamically reads a schema name and table name from an input table. The code then needs to loop through all rows and columns of each table and output the data. I'm 95% done with what I want to accomplish, but there is one small bug. The line dbms_output.put(*col.column_name* || '',''); ' ||
    should refer to something like rec.col.column_name so that it gets the column of the current record. Right now it just displays the column name for each record instead of the actual value. Can anyone help me tweak the code to get the actual value?
    CREATE OR REPLACE PACKAGE BODY some_proc IS
    -- Function and procedure implementations
    PROCEDURE create_files IS
    CURSOR c_tbls IS
    SELECT * FROM tbl_list;
    l_sql VARCHAR2(4000);
    BEGIN
    --Loop through all tables
    FOR tbl IN c_tbls LOOP
    l_sql := 'DECLARE ' || ' CURSOR c_tbl_recs IS ' || ' SELECT * ' ||
    ' FROM ' || tbl.schema_name || '.' || tbl.table_name || '; ' ||
    ' t_tbl_rowtype c_tbl_recs%ROWTYPE; ' || 'BEGIN ' ||
    ' FOR rec IN c_tbl_recs LOOP ' ||
    ' FOR col IN (SELECT column_name ' ||
    ' FROM dba_tab_cols ' ||
    ' WHERE owner = ''' || tbl.schema_name || '''' ||
    ' AND table_name = ''' || tbl.table_name || '''' ||
    ' ORDER BY column_id) LOOP ' ||
    *' dbms_output.put(col.column_name || '',''); ' ||* ' END LOOP; dbms_output.put_line(''''); END LOOP; ' ||
    'END; ';
    --dbms_output.put_line(l_sql);
    EXECUTE IMMEDIATE l_sql;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(SQLERRM);
    END;
    END;

    Is it this what you are looking for?
    (it took some minutes)
    create or replace
    package some_proc is
    procedure create_files;
    end;
    CREATE OR REPLACE
    PACKAGE BODY some_proc
    IS
      -- Function and procedure implementations
    PROCEDURE create_files
    IS
      CURSOR c_tbls
      IS
        SELECT * FROM tbl_list;
      CURSOR c_cols (p_table_owner VARCHAR2, p_table_name VARCHAR2)
      IS
        SELECT column_name
        FROM all_tab_columns
        WHERE owner   =p_table_owner
        AND table_name=p_table_name
        ORDER BY all_tab_columns.column_id;
      l_sql     VARCHAR2(32000);
      separator VARCHAR2(1):=';';
    BEGIN
      --Loop through all tables
      FOR tbl IN c_tbls
      LOOP
        dbms_output.put_line('TABLE: '||tbl.schema_name||'.'||tbl.table_name);
        l_sql := 'DECLARE ' ;
        l_sql := l_sql|| '  CURSOR c_tbl_recs IS ' ;
        l_sql := l_sql||'    SELECT * FROM ' || tbl.schema_name || '.' || tbl.table_name || '; ' ;
        l_sql := l_sql||'    linenr number:=1; ';
        l_sql := l_sql||'BEGIN ' ;
        l_sql := l_sql|| ' FOR rec IN c_tbl_recs LOOP ';
        FOR c IN c_cols(tbl.schema_name,tbl.table_name)
        LOOP
          l_sql:=l_sql ||' if linenr=1 then  dbms_output.put('''||c.column_name||''||separator||'''); end if; ' ;
        END LOOP;
        l_sql :=l_sql||'  dbms_output.put_line(''''); linenr:=linenr+1; ';
        FOR c IN c_cols(tbl.schema_name,tbl.table_name)
        LOOP
          l_sql:=l_sql ||' dbms_output.put(rec.'||c.column_name||'||'''||separator||'''); ' ;
        END LOOP;
        l_sql:=l_sql||'  end loop; ';
        l_sql:=l_sql||'  dbms_output.put_line(''''); ';
        l_sql:=l_sql||'  dbms_output.put_line(''''); ';
        l_sql:=l_sql||'end;';
        EXECUTE IMMEDIATE l_sql;
      END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line(SQLERRM);
    END;
    END;
    /

Maybe you are looking for

  • Can i use multiple apple ID in 1 phone

    i have applID which i used to use to purchase apps from itune (this ID is nolonger my email address). after chaged to icloud from mobilme, i have to use different ID.   now, to update apps, i have to use old ID and for new purchase i have to use othe

  • HP Officejet Pro 8500A Plus power problem

    My HP 8500A Plus just stopped working. The power light is one but the control pad is off and the printer doesn't work.  I unplugged the printer from my surge protector and plugged it directly into a wall outlet but nothing changed.  I cannot turn the

  • How to transfer purchased ringtones from iphone4S to iphone6

    How to transfer purchased ringtones from iphone4S to iphone6, have tried syncing to no success

  • Safe boot after software updates

    when i install updates from software updates and restart my mac mini, it always goes into safe boot mode. i then have to log in and restart. after restarting everything is back to normal. this problem has been happening since i did a clean install of

  • Media goes offline everytime I change windows?

    This is really frustrating, I can't get into editing because every time I change windows (from Premiere, to Bridge, for example) and then change back, it attempts to link files and they go offline. I re-link them and try to get on with it, and it hap