-- WHILE için mutlaka fonksiyon kurman gerek. -- Function: "test_WHILE"(integer) -- DROP FUNCTION "test_WHILE"(integer); CREATE OR REPLACE FUNCTION "test_WHILE"(integer) RETURNS integer AS $BODY$ DECLARE --userNum ALIAS FOR $1; i integer; BEGIN i := 0; WHILE (i <= 20 ) loop insert into public."TestTable" (name,surname,email) select name,surname,email from public."Customer"; i = i+1; end loop; RETURN i; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; ALTER FUNCTION "test_WHILE"(integer) OWNER TO postgres;