Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- drop function ProcessReward();
- CREATE OR REPLACE FUNCTION ProcessReward()
- RETURNS text AS $$
- DECLARE
- sessionid NO SCROLL CURSOR FOR SELECT pg."Setting",pg."UserId",pg."Id" FROM "Development"."PersonGame" pg inner join "Development"."Game" g on g."Id" = pg."GameId" pg."GameId"=1 for read only;
- titles TEXT DEFAULT '';
- rec record;
- jsonrec record;
- jsonrecord record;
- BEGIN
- OPEN sessionid;
- loop
- FETCH sessionid INTO rec;
- if not found then
- exit ;
- end if;
- EXECUTE 'select * from "Development"."GameRecipient" where "PersonGameId"=$1' into jsonrecord using rec."Id";
- --I want to loop here every row returned by above query
- --loop start
- -- do your task
- --loop end
- end loop;
- return titles;
- END;
- $$ LANGUAGE plpgsql;
- col1 col2 col3
- 123 324 444
- 345 222 765
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement