Advertisement

06.11.2007 at 11:54AM PDT, ID: 22626717
[x]
Attachment Details

Oracle 10g PL/SQL REF Cursor get Column Names Dynamically

Asked by marbro in Databases Miscellaneous, Oracle Database, PL / SQL

Tags: , , , ,

While looping through a cursor I need to loop through each column without knowing the column name.  For instance

This works:
LOOP
 FETCH MVAR_cursor into MVAR_record;
 EXIT WHEN MVAR_cursor%NOTFOUND;
    MVAR_record.COLUMNNAME1;
     MVAR_record.COLUMNNAME2;
 END LOOP;
CLOSE MVAR_cursor;

Since I won't know the column name,  I need something like this:
LOOP
 FETCH MVAR_cursor into MVAR_record;
 EXIT WHEN MVAR_cursor%NOTFOUND;
   i := i+1;
    MVAR_record.column(i);
 END LOOP;
CLOSE MVAR_cursor;

thx
Start Free Trial
[+][-]06.11.2007 at 01:19PM PDT, ID: 19261452

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.11.2007 at 02:40PM PDT, ID: 19262067

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.11.2007 at 10:23PM PDT, ID: 19263806

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Databases Miscellaneous, Oracle Database, PL / SQL
Tags: oracle, cursor, column, get, name
Sign Up Now!
Solution Provided By: sujith80
Participating Experts: 3
Solution Grade: A
 
 
[+][-]06.12.2007 at 08:58AM PDT, ID: 19267310

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.12.2007 at 08:59AM PDT, ID: 19267319

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32