CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Jul 2015
    Posts
    3

    Problem in Select all from table using procedure oracle

    I am trying to execute the select command in a procedure.Initially i retrived all of the columns of the table in the procedure using cursor. The real problem comes when I am trying to access the elements of the coloumn. It is printing the names of the columns again without printing the elements of the columns and also with an error!



    HTML Code:
    set serveroutput on;
    CREATE OR REPLACE PROCEDURE show_all1
    AS
    cursor gen_row is
    select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME='TESTNIRMAL';
    cursor gen1_row(i varchar) is
    select i  from testnirmal;
    a1 varchar2(22);
    a2 varchar2(10);
    BEGIN
    open gen_row;
    for data in(SELECT * from testnirmal)
    loop
    fetch gen_row into a1;
    open gen1_row(a1);
    fetch gen1_row into a2;
    dbms_output.put_line(a2);
    close gen1_row;
    end loop;
    close gen_row;
    END show_all1;
    /

    DEF_ID and ID1 are the two columns in my table and the table name is testnirmal. The procedure is created without any compilation errors. But while executing the procedure I am getting this.


    Code:
    DEF_ID ID1
    Last edited by Nabhi18; July 10th, 2015 at 07:18 AM.

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured