Bryan Tonnet wrote:
>
> In <57vgr3$lvj@cybernet.cse.fau.edu> barton@aura.irm.fau.edu (system PRIVILEGED account) writes:
...
> >The following is my best try:
> > LET p_sql_stmt = "SELECT COUNT(*) FROM v3 WHERE ", p_where_clause
> > PREPARE pre_count FROM p_sql_stmt
> > EXECUTE pre_count INTO p_row_cnt
> >|_________________________^
> >|
> >| A grammatical error has been found on line 169, character 27.
> >| The construct is not understandable in its context.
> >| See error number -4373.
...
> 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. This is explicitly documented (I don;t have
the manuals in front of me) as the only way to run a prepared SELECT
statement. Cursor/fetch for any statement that is expected to return
data. (select, EXECUTE PROCEDURE that returns data) You have no reason
to complain about that.
However, I have hated the -4373 message since the first day I saw it!
YUCHH! SO exquisitely meaninless!! ;-))
-- jake