| From: | "Keith Worthington" <keithw(at)narrowpathinc(dot)com> |
|---|---|
| To: | "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org> |
| Subject: | language "plpgsql" does not exist |
| Date: | 2004-12-16 23:02:04 |
| Message-ID: | 20041216230204.M24736@narrowpathinc.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
Hi All,
I am trying to build a function to insert or update data in one table from
date stored in another table. Eventually I hope to trigger this process based
on data being INSERTed into the original table. I have written the code below
based on the documentation and some help from this list. When I execute the
code I get this error.
ERROR: language "plpgsql" does not exist
What does this mean? How do I correct the error?
Kind Regards,
Keith
PS This is PostgreSQL v7.3.6 on Red Hat Enterprise Linux v3
CREATE FUNCTION xfer_gl_account_data() RETURNS INTEGER AS '
DECLARE
rcrd_gl_account RECORD;
BEGIN
FOR rcrd_gl_account IN SELECT
data_transfer.tbl_peachtree_gl_acount.account_id,
data_transfer.tbl_peachtree_gl_acount.description,
data_transfer.tbl_peachtree_gl_acount.account_type,
data_transfer.tbl_peachtree_gl_acount.inactive
FROM data_transfer.tbl_peachtree_gl_acount
ORDER BY gl_number
LOOP
SELECT peachtree.tbl_gl_account.account_id
FROM peachtree.tbl_gl_account
WHERE peachtree.tbl_gl_account.account_id = rcrd_gl_account.account_id;
IF NOT FOUND THEN
INSERT INTO peachtree.tbl_gl_account
( peachtree.tbl_gl_account.account_id,
peachtree.tbl_gl_account.description,
peachtree.tbl_gl_account.account_type,
peachtree.tbl_gl_account.inactive )
VALUES ( rcrd_gl_account.account_id,
rcrd_gl_account.description,
rcrd_gl_account.account_type,
rcrd_gl_account.inactive );
ELSE
UPDATE peachtree.tbl_gl_account
SET peachtree.tbl_gl_account.description =
rcrd_gl_account.description,
peachtree.tbl_gl_account.account_type =
rcrd_gl_account.account_type,
peachtree.tbl_gl_account.inactive = rcrd_gl_account.inactive
WHERE peachtree.tbl_gl_account.account_id =
rcrd_gl_account.account_id;
END IF;
END LOOP;
RETURN 1;
END;
' LANGUAGE 'plpgsql';
______________________________________________
99main Internet Services http://www.99main.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Terry Lee Tucker | 2004-12-16 23:37:56 | Re: language "plpgsql" does not exist |
| Previous Message | Luiz K. Matsumura | 2004-12-16 21:34:04 | Re: basic download and setup questions |