Bonjour à tous, je débute sur postgresql et j'écris depuis hier mes premières fonctions. J'ai un problème avec celle-ci qui doit me renvoyer tous les enregistrements de la table "Deliveries" dont le champ "receiverLogin" est égal au paramètre et le champ "state" est égal à 'DOWNLOADING' :
Quand je fais un test (SELECT getexchangeinputs('a')) j'ai l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 CREATE OR REPLACE FUNCTION getexchangeinputs(_receiver text) RETURNS SETOF "Deliveries" AS $BODY$ DECLARE delivery "Deliveries"%ROWTYPE; BEGIN FOR delivery IN SELECT * FROM "Exchanges" WHERE ("receiverLogin"=_receiver AND "state"='DOWNLOADING') LOOP RETURN NEXT delivery; END LOOP; RETURN; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100; ALTER FUNCTION getexchangeinputs(text) OWNER TO dtc; GRANT EXECUTE ON FUNCTION getexchangeinputs(text) TO public; GRANT EXECUTE ON FUNCTION getexchangeinputs(text) TO dtc;Or aucun enregistrement n'a la valeur "a" dans un timestamp (voir image jointe), suis-je passé à côté de quelque chose? (oui sûrement sinon ça fonctionnerait...)ERROR: invalid input syntax for type timestamp with time zone: "a"
CONTEXT: PL/pgSQL function "getexchangeinputs" line 4 at FOR over SELECT rows
Partager