Disaridan iki cift Parametreli Fonksiyon Function Delete
Definition Description
--Asagidaki fonksiyon, disaridan 2 parametre alarak, istedigin kadar silme yaptirabiliryorsun -- s kackere dongu icinde donmesi icin -- limit de kac deger olmasi gerektigini acikliyor CREATE OR REPLACE FUNCTION "PushNotification"."DeletePushNotificationLogWithTwoParameter"( s integer, j integer) RETURNS integer LANGUAGE 'plpgsql'
COST 100 VOLATILE AS $BODY$ DECLARE i INTEGER; BEGIN i := 0; WHILE( i <=s ) loop DELETE FROM "PushNotification"."PushNotificationLog" Where "Id" in (SELECT "Id" FROM "PushNotification"."PushNotificationLog" Where "CreationDate"<=(CURRENT_TIMESTAMP - INTERVAL '45 day') Order by "Id" limit j); i = i + 1; END loop; RETURN i; END; $BODY$;
ALTER FUNCTION "PushNotification"."DeletePushNotificationLogWithTwoParameter"(integer, integer) OWNER TO postgres;