Re: OCI Question regarding select *

From: Ben Bryant <comment_at_firstobject.com>
Date: Tue, 27 Jul 1999 13:21:21 GMT
Message-ID: <lnin3.28399$UK2.18035_at_news.rdc1.md.home.com>


Premal,

First, execute the SELECT statement with OCIStmtPrepare and OCIStmtExecute. Second, use OCIParamGet and OCIAttrGet to find out what columns were returned. You might be interested in COdb which uses the OCI to do just what you are talking about, among other things:

COdb db;
db.Open( "scott/tiger_at_host2" );
db.Select( "select * from tab1" );
while ( ! db.IsEOS() )
{
 // Loop through fields
 int iField = 0;
 CString csName, csValue;
 while ( db.GetField(iField++,csName,csValue) )   Output( csValue );

 // Get next record
 db.FetchNext();
}

The .cpp/.h is available free at
http://www.codeguru.com/mfc_database/Osql10.shtml ... If you are using VC++ you can add it to your project and probably have it doing what you want in a short time. If you like it, please leave a comment at the CodeGuru site.

Thanks,
Ben

<premal_shah_at_my-deja.com> wrote in message news:7na069$o2l$1_at_nnrp1.deja.com...
> Hi! Folks:
>
> I am trying to generate a flat file of the data of all tables in the
> database via OCI to allow SQL*Loader to load the data later in the
> database.
>
> I need to do a select * from <tablename> for all the tables.
>
> I was thinking of writing an OCI application using a combination of
> OCIAttrGet(), OCIParamGet() and OCIDefineArrayOfStructs().
>
> Could you please give me some pointers as to the best way to achieve
> this in OCI?
>
> Thanks a lot for your help.
>
> regards,
> premal
> mumbai
> india
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Tue Jul 27 1999 - 15:21:21 CEST

Original text of this message