From: | Andreas Kretschmer <akretschmer(at)spamfence(dot)net> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Error near delete in plpgsql function |
Date: | 2011-06-06 16:18:53 |
Message-ID: | 20110606161853.GA8166@tux |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Saqib Ilyas <msaqib(at)gmail(dot)com> wrote:
> Hi folks
> I have the following function in a file called deletescript.sql.
>
> CREATE OR REPLACE FUNCTION delete_items() RETURNS integer AS '
$$
> DECLARE
> m RECORD;
> n RECORD;
> BEGIN
> FOR m in SELECT item_id from ITEM where owning_colletion=37 LOOP
> FOR n in SELECT workflow_id from workflowitem where collection_id=37
> and item_id=m.item_id LOOP
> delete from tasklistitem where workflow_id=n.workflow_id;
> END LOOP
> delete from workflowitem where collection_id=37 and item_id=m.item_id;
> END LOOP;
> delete from item where owning_collection=37;
> return 1;
> END;
> ' LANGUAGE plpgsql;
$$
change the ' to $$
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
From | Date | Subject | |
---|---|---|---|
Next Message | Erasmo Zottola - Elman | 2011-06-08 14:39:35 | PL/pgSQL editor/debugger |
Previous Message | Tom Lane | 2011-06-06 16:16:54 | Re: Error near delete in plpgsql function |