Hi all;
How can i catch end of the cursor?
i make something above. it is working because gelirkod_idno is pirmary key and unique. But may be the way to handle the fetch staus.
Best Regards..
How can i catch end of the cursor?
Code:
CREATE OR REPLACE FUNCTION "public"."fnc_rapthsbordro" (bastar date, bittar date, basmuk integer, bitmuk integer, basmak varchar, bitmak varchar, siralama varchar, tip boolean) RETURNS varchar AS $body$ declare intgelirkod integer; declare intgelirkod1 integer; declare gelircurs cursor for select gelirkod_idno from tbl_gelirkodlari order by gelirkod_idno; begin open gelircurs; fetch gelircurs into intgelirkod; while intgelirkod>0 loop intgelirkod1 = intgelirkod; fetch gelircurs into intgelirkod; if intgelirkod = intgelirkod1 then /* if previous */ intgelirkod = 0; end if; end loop; end; $body$ LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
Best Regards..
Comment