PGSQL循环语句FOR每一条记录,PGSQL循环每一行


CREATE OR REPLACE FUNCTION tuomin() 
  RETURNS VOID 
AS
$$
DECLARE 
   t_row RECORD;
BEGIN
    FOR t_row in (SELECT * FROM userx) LOOP
        update userx set usr ='xxx'; 
    END LOOP;
END;
$$
LANGUAGE plpgsql;

SELECT tuomin() as output;

你可能感兴趣的:(PGSQL)