Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Bryan Tonnet — — source: Informix-list mailing list archive (1991-1998)
In <57vgr3$lvj@cybernet.cse.fau.edu> barton@aura.irm.fau.edu (system PRIVILEGED account) writes:
>I've been having all kinds of fun today with trying to get the
>proper syntax for a PREPARE statement.
>This is being coded in 4GL.
>I'm creating a WHERE clause from parameters given in an HTML
>form. The resulting SELECT statement is a simple COUNT(*) of
>records. Problem is, how do I get the returned value for COUNT(*)?
>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.
>p_row_cnt has been declared as both INTEGER and CHAR(10) with the same
>results.
It's good isn't it. I've had the same problem and ended up just declaring
a cursor and being done with it.
LET p_sql_stmt = "SELECT COUNT(*) FROM v3 WHERE ", p_where_clause
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.
Bryan Tonnet
batonnet@zeta.org.au
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.