Re: I4gl query
Posted in 1998
Hi,
I think in this case you shouldn't use cursors. You could just perform
the select as:
select count(*)
into no_of_rec
from tt_extract
where tt_accno = l_tt_accno
If you really want to use a prepared stmt/cursor just modify your
string to look like:
LET sel_stmt = " SELECT COUNT(*) FROM tt_extract",
" WHERE tt_accno = '", l_tt_accno
Well, it should work.
Kind regards,
Octav
RIAZJKAPADIA wrote:
>I am writing this program in i4gl version 7.20D. As you can see in the
>program below that my query returns only one value that is no or rows. For
>that I have to declare it as cursor and then open the cursor to get the
>number. Is there any other way by which I can get the no of counts without
>having to declare it as a cursor and then opening it. I tried "EXECUTE
>count_rec INTO no_of_rec" but it is giving me an error saying syntax not
>recognisable
>
>DEFINE l_tt_accno integer
>---------------
>----------
>LET sel_stmt = " SELECT COUNT(*) INTO no_of_rec FROM tt_extract",
> " WHERE tt_accno = '", l_tt_accno,
> ----------
>-----------
> PREPARE count_rec FROM sel_stmt
> DECLARE cursor_count CURSOR FOR count_rec
> OPEN cursor_count
> FETCH cursor_count INTO no_of_rec
>
>
>thanks
>
>Riaz
--
Octav Chiriac Phone: (373) 2 21 20 96
NetInfo S.R.L. Fax: (373) 2 21 36 59
Chisinau (373) 2 24 00 83
Moldova, Republic of mailto:com@netinfo-moldova.com