[SQL] Cursor
Hi, guys... I have problems with cursosrs. Anyone have an example complete the how load and read each position of a cursor? I wait your answer Thanks...guys
[SQL] Cursor
hi guys... This my cursor DECLARE var varchar(15); cursor1 CURSOR FOR select codigo_uni as codigo from recorrido where estado='V'; BEGIN open cursor1; var=cursor1.codigo; END; It's almost 200 records, but, I not unknow how read record for record, I need found one record specific, Excuse me my english, no write nothing goog, I'm from ecuador. Or explain how, I use the loop, while, in my function declarated. Please, more guides Thanks
Re: [SQL] Cursor
Xavier Bermeo wrote: Hi, guys... I have problems with cursosrs. Anyone have an example complete the how load and read each position of a cursor? I wait your answer Thanks...guys Assuming you're using ECPG, there are a couple of examples in the documentation, e.g., http://www.postgresql.org/docs/8.3/static/ecpg-commands.html (see Select using cursors: http://www.postgresql.org/docs/8.3/static/ecpg-variables.html#AEN33442 The essence is you DECLARE the cursor, OPEN it and then FETCH rows in some kind of loop, and finish by CLOSE cursor. To exit the loop, you can check sqlca.sqlcode for 100 (NOT FOUND) or a SQLSTATE of 02000. Joe -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
