Taken almost literally from the tutorial example (http://www.postgresql.org/idocs/index.php?app-ecpg.html) the
followingcode:
<connectino establishment succesfull up to here>
EXEC SQL DECLARE my_cursor CURSOR FOR SELECT a,b FROM lala WHERE a= :i;
EXEC SQL FETCH FORWARD NEXT FROM my_cursor INTO :tmpa,:tmpb;
throws the following error in the logs:
2001-06-18 15:41:02 DEBUG: query: begin transaction
2001-06-18 15:41:02 DEBUG: ProcessUtility: begin transaction
2001-06-18 15:41:02 DEBUG: query: fetch forward next from my_cursor
2001-06-18 15:41:02 DEBUG: ProcessUtility: fetch forward next from my_cursor
2001-06-18 15:41:02 NOTICE: PerformPortalFetch: portal "my_cursor" not found
I check the .c file generated by ecpg and the cursor declaration is commented out :-(
#line 10 "main.pgc"
/* declare my_cursor cursor for select a , b from lala where a = ? */
#line 11 "main.pgc"
what's missing?
thanks,
thalis
ps there is a spelling mistake in the tutorial:
EXEC SQL FETCH foo_bar INTO :FooBar,DooDad; should be
EXEC SQL FETCH foo_bar INTO :FooBar,:DooDad;