'ERROR: ERROR: query has no destination for result data
I have developped a procedure in my postgresql DB that sends an email to someone, my procedure works well when it was like that :
CREATE OR REPLACE PROCEDURE fond_plan.send_mail_approche_date(
)
LANGUAGE 'plpgsql'
AS $BODY$DECLARE
test integer NOT NULL DEFAULT 0;
BEGIN
perform pgmail('my_email', 'another_email', 'its working', 'its working', '');
END IF;
END;$BODY$;
However when I added some SELECT to it, now it looks like that :
CREATE OR REPLACE PROCEDURE fond_plan.send_mail_approche_date(
)
LANGUAGE 'plpgsql'
AS $BODY$DECLARE
test integer NOT NULL DEFAULT 0;
BEGIN
SELECT * FROM fond_plan.arretes_de_voiries_evw;
IF date(date_debut) = CURRENT_DATE AND statut = 'En instruction collectivité' THEN
perform pgmail('my_email', 'another_email', 'its working', 'its working', '');
END IF;
END;$BODY$;
So now when I run :
CALL fond_plan."send_mail_approche_date"()
I get the following error :
ERROR: ERROR: query has no destination for result data
HINT: If you want to override the results of a SELECT, use PERFORM instead.
CONTEXT: PL/pgsql function fond_plan.send_mail_approach_date(), line 5 to SQL statement
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
