Problem with Function and Trigger ! Urgent !!!

Started by De Leeuw Guyabout 25 years ago1 messagesgeneral
Jump to latest
#1De Leeuw Guy
G.De_Leeuw@eurofer.be

Hi all
I create this function and this trigger :
Before starting this, I start from the command prompt : createlang plpgsql
myDB

CREATE FUNCTION DelArtFather()
RETURNS opaque
AS '
DELETE FROM TArticles WHERE IdArtFather = OLD.IdArt;
RETURN OLD;
'
LANGUAGE 'plpgsql';

CREATE TRIGGER trigger_TArticles
BEFORE DELETE ON TArticles
FOR EACH ROW EXECUTE PROCEDURE DelArtFather();

And I execute the query :
DELETE FROM TArticles WHERE IdArt = 1;
I Receive :
NOTICE: plpgsql: ERROR during compile of delartfather near line 1
ERROR: parse error at or near "DELETE" occured !

Any Idee ?

Guy