Re: Number of Rows in a Select --- How?
Posted in 1996
On 12 Jul 96 at 20:19, Rajendra Singh wrote:
} I am doing the following in ESQL/C using SE:
} - preparing a statement
} - declaring a cursor for it
} - opening the cursor
}
} The statement is something like "select * from x where y = z"
}
} How do I determine how many rows will be fetched? I looked at the
} "sqlca" structure, but it doesn't seem to provide a definitive answer.
} I tried using sqlerrd[0] and sqllerr[3] (after I opened the cursor),
} but they always seem to contain the value "1". Should I check these
} members after the prepare? Or is there some other way (short of
} counting) to determine how many rows will be fetched?
}
Define a temporary variable and then Define a cursor prior to your
cursor given above, as follows:
select count(*) into tmp_count
from x where y = z
tmp_count will have the number of rows that will be selected.
Gopi.