ESQL/C

Problem: How do I Run an "UNLOAD" Command from ESQL/C?

ESQL/C does not support the UNLOAD command. How can I duplicate this functionality in ESQL/C?

Answer: Use an ESQL/C Program to Unload Data

Write an ESQL/C program along the lines of this one:

strcpy (select_string, "SELECT field1, field2, ...FROM tablename WHERE ....")
$PREPARE my_statement from select_string;
$DECLARE my_cursor CURSOR for my_statement;

while ()
{
$FETCH my_cursor INTO variable1, variable2....;
if  ( sqlca.sqlcode != 0 )
       {
$CLOSE my_cursor;
$FREE my_cursor;
break;
       }

frprintf (stdout, "%s|%s|%s....
", variable1, variable2....);
 }

Of course, you have to specify the select statement and declare and arrange the variables correctly, but this can allow you to achieve the needed functionality.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.109.151