Number of lines returned by a query from embedded SQL

From: Renato Fabiano <renatofabiano_at_hotmail.com>
Date: 16 Jan 2002 05:28:46 -0800
Message-ID: <2358ca76.0201160528.4cb2f400_at_posting.google.com>


Hi,

I would like to know many lines will be returned by a dynamic SQL query from embedded SQL BEFORE the FETCH statement execution.

I am developing a program using embedded SQL with Pro*C, Release 8.1.6. In order to discover how many lines were returned by a query AFTER the FETCH I can access the sqlca.sqlerrd[2] field of sqlca.

It's not possible to use COUNT because the SQL statement is dynamic.

I am using the following embedded SQL statements:

EXEC SQL AT :globalConnection DECLARE Query1 STATEMENT; EXEC SQL DECLARE Cursor1 CURSOR FOR Query1;

EXEC SQL PREPARE Query1 FROM :SqlStatement; EXEC SQL OPEN Cursor1;
EXEC SQL DESCRIBE SELECT LIST FOR Query1 INTO SqlDaArea;
==> I want to know the number of lines that will be returned til here,
but sqlca.sqlerrd[2] is always 0 at this point EXEC SQL FOR :numLines FETCH Cursor1 USING DESCRIPTOR SqlDaArea;
==> sqlca.sqlerrd[2] is available only at this point
EXEC SQL CLOSE Cursor1;

Thanks in advance,

Renato Fabiano Received on Wed Jan 16 2002 - 14:28:46 CET

Original text of this message