Re: EXECUTE ... SELECT COUNT(*) ... INTO ?
Posted in 1996
Jake Salomon wrote: > > Bryan Tonnet wrote: > >... > > PREPARE pre_count FROM p_sql_stmt > > DECLARE a_curs CURSOR FOR pre_count > > OPEN a_curs > > FETCH a_curs INTO p_row_cnt > > CLOSE a_curs > > > > Ugly, but functional. > > Folks, > > it's a lot more than "ugly but functional". This is *the* way to > accomplish your purpose. >... You might want to consider adding the "FREE" statement to this conglomeration to free database resources. Different versions of the manuals seem to say different things about the minimum needed to free everything but the following will do it for sure: prepare p_name from ... declare c_name cursor for p_name open c_name fetch c_name into ... close c_name free c_name free p_name There it is, a prepared singleton select statement, even uglier than you thought. :-) Maybe it could be packaged in functions - Does anyone do this? ---------------------------------------------------------------------- John H. Frantz Power-4gl: Extending Informix-4gl frantz@centrum.is http://www.rl.is/~john/pow4gl.html