PERFORM statement question

From: "Keith Worthington" <keithw(at)narrowpathinc(dot)com>
To: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: PERFORM statement question
Date: 2004-12-17 00:50:27
Message-ID: 20041217005027.M82709@narrowpathinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi All,

Well, I am continueing to make progress on my function to transfer or update
data as required. However I have hit another snag. After I successfully
create the function below I atttempt to run it with the command

SELECT xfer_gl_account_data();

And get the error

WARNING: Error occurred while executing PL/pgSQL function xfer_gl_account_data
WARNING: line 11 at assignment
ERROR: parser: parse error at or near "SELECT" at character 9

This was an error regarding not using a PERFORM statement but now the PERFORM
is in there and it still won't work. I have read
http://www.postgresql.org/docs/7.3/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-PERFORM
to no avail.

Obviously I am not using the PERFORM command peroperly but I do not
understand. Hints greatly appreciated.

Kind Regards,
Keith

CREATE OR REPLACE 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_account.account_id,

data_transfer.tbl_peachtree_gl_account.description,

data_transfer.tbl_peachtree_gl_account.account_type,

data_transfer.tbl_peachtree_gl_account.inactive
FROM data_transfer.tbl_peachtree_gl_account
ORDER BY
data_transfer.tbl_peachtree_gl_account.account_id
LOOP
PERFORM 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John DeSoi 2004-12-17 00:52:56 Re: basic download and setup questions
Previous Message Afton & Ray Still 2004-12-17 00:26:30 Re: basic download and setup questions