Re: PRO*C PL/SQL PROBLEM!!!!!!

From: KRowden <krowden_at_aol.com>
Date: 1995/12/12
Message-ID: <4alevl$o0v_at_newsbf02.news.aol.com>#1/1


In article <4ahao5$o79_at_vivaldi.belnet.be>, jtimmerm_at_alpha (Jan Timmermans) writes:

>Can anybody outhere tell me how to refer to a column from which the name
>is only known at run-time. All the columns in the table, except for one,
 are
>added to the table after the pro-c program is compiled.
>The program only knows the name and the type of the column at runtime.
>I want to select the value from that column in a PRO*C program.
>I tried it with DBMS_SQL but this didn't work.
>Can someone show me exactly what to do ?

I'll assume the following:
1. You already have a table with one column such as CREATE TABLE T1 (C1 CHAR(5))
2. In your C program you alter the table to add additional columns (such as C2, C3 and C4).

To be able to access the column names at run-time you'll need to use dynamic SQL (method 4 in the OCI - check the manual, I can't remember the specific page). With method 4 you'll be able to sumit a query such as "SELECT * FROM T1 WHERE ...etc" and get back a list of pointers to the column NAMES and the column DATA. Wondeeeful.

Of course..... this begs the question: If your app is the one doing the alter table statement at run-time why wouldn't it already know these column names...? What is your app actually doing?

Kim.
"Apps for the Mobile Workforce" Received on Tue Dec 12 1995 - 00:00:00 CET

Original text of this message