Thread: ECPG and FETCH
First of all, ECPG doesn't seem to recognise the FETCH command at all, returning with Syntax Error (see below). Secondly, are there any postgres specific Embedded SQL docs around 'anywhere'? I've already have a few difficulties with subtle differences between different precompiler syntax, and it's becoming frustrating. Thanks for any help! Tim. eg: EXEC SQL DECLARE rowcur CURSOR FOR SELECT prod_id, name, format FROM products WHERE name like'%ABC%'; EXEC SQL OPEN rowcur; for (i=0; i<5; i++) { EXEC SQL FETCH rowcur INTO :prod_id, :title, :format; // Do something. }
On Wed, Jan 05, 2000 at 06:24:51PM +1100, Tim Kane wrote: > EXEC SQL FETCH rowcur INTO :prod_id, :title, :format; > Try EXEC SQL FETCH IN rowcur ... Ivo.
> Secondly, are there any postgres specific Embedded SQL docs around > 'anywhere'? > I've already have a few difficulties with subtle differences between > different precompiler syntax, and it's becoming frustrating. That's one of the holes in our documentation. If you get inspired to write, we would welcome a contribution of any sort (including just your notes on syntax as you learn to use the preprocessor). Our doc sources are in sgml, but if you want to just write flat files I'll convert it for you... - Thomas -- Thomas Lockhart lockhart@alumni.caltech.edu South Pasadena, California
On Wed, Jan 05, 2000 at 06:24:51PM +1100, Tim Kane wrote: > First of all, ECPG doesn't seem to recognise the FETCH command at all, > returning with Syntax Error (see below). FETCH IN should work as well as FETCH FROM. I think this is what standard says. I once tried to add FETCH without IN but got some shift/reduce conflicts. I haven't looked into it for quite some time, so maybe I can add a compatibility rule. But don't bet on it. > Secondly, are there any postgres specific Embedded SQL docs around > 'anywhere'? Unfortunately not much. But there are some (5 to be precise) demo files in the source tree. Michael -- Michael Meskes | Go SF 49ers! Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire! Tel.: (+49) 2431/72651 | Use Debian GNU/Linux! Email: Michael@Fam-Meskes.De | Use PostgreSQL!