How to store the result set from SELECT query using CLIv2 programming

Analytics
Enthusiast

How to store the result set from SELECT query using CLIv2 programming

Hi,

I'm new to Teradata and trying to write simple program using CLIv2 (Teradata version 12). Using the sample cli code provided by Teradata I could able to connect and execute the statements like CREATE TABLE, INSERT INTO.. But when I want to fetch the result set of a query SELECT * from SAMPLES.table1 I'm facing problem in coding. I dont know how to get the records from the query. Could any one help me in coding this. According to me after executing the query using DBCHCL(&result,cnta,&dbcarea), the result will be stored in dbcarea.fet_data_ptr; I dont know for which structure I have to type cast this, and also do I need to take care of the Data Types returned by the result set. In the Teradata sample program, it is reading character by character and storing in a file. I want to how to read a Database column. I sample example for fetching the records will be very helpful me.