program to retrieve datbase table names

Database

program to retrieve datbase table names

Hi,

I am new to teradata, using following SQL query in Teradata SQL assist i am able to retrieve table names

SELECT TABLENAME, tablekind FROM DBC.TABLES WHERE DATABASENAME = 'DBC' AND TABLEKIND = 'T' ;

When i tried to pass the same SQL query in DBCHCL() function, i am just getting only Database table column related description. Not getting table list information, teradata response to SQL query always returns  zero bytes.

What is the proper order to invoke DBCHCL() with proper input options information set, is there is any code example exists to fetch the table list?

4 REPLIES
Teradata Employee

Re: program to retrieve datbase table names

So you are using CLIv2 in a C/C++ application? Under the cliv2 install directory is a clisamp directory with source for a sample program.

After the DBFIRQ (Initiate Request) call with a data-returning statement, you make one or more DBFFET (Fetch) calls to retrieve data, and then should make a DBFERQ (End Request) call to indicate you are done with the response.

Re: program to retrieve datbase table names

Hi,

Yes i am using CLIv2 in a C/C++ application.

After the DBFIRQ (Initiate Request) call with a data-returning statement, it returns metadata of DBC.TABLES with column TABLENAME, tablekind description. On making call to DBFFET (Fetch), it returns resp_ buf_len with 2 bytes and dbcarea_->fet_parcel_flavor value set to pclENDSTATEMENT. It returns no response.

Re: program to retrieve datbase table names

Hi,

I could not find the clisamp directory, could you please send me link to it.

Teradata Employee

Re: program to retrieve datbase table names

DBFCON returns a status parcel. Did you close the Connect request before the DBFIRQ?

Have you checked DBQL to verify that the statement was sent to the database and executed?

On Unix / Linux there is a shared code sample directory /opt/teradata/client/vv.vv/sample

On 64-bit Windows, there is a separate ...\CLIv2\clisamp

The sample program is clisamp.c