X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 31AB730EFEA for ; Tue, 17 Jun 2003 01:55:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 28630-05 for ; Mon, 16 Jun 2003 22:54:57 -0300 (ADT) Received: from m14.lax.untd.com (m14.lax.untd.com [64.136.30.77]) by svr1.postgresql.org (Postfix) with SMTP id 208DB30EF90 for ; Mon, 16 Jun 2003 22:54:57 -0300 (ADT) Received: from cookie.untd.com by cookie.untd.com for <"xwqiq7RDh13MUwhLKe6dkQFPIjIg8IaMeVzi4d99N4hMJ8Cfo3BrPg==">; Mon, 16 Jun 2003 18:54:21 PDT Received: (from tgharris_1@juno.com) by m14.lax.untd.com (jqueuemail) id H2UEKVLP; Mon, 16 Jun 2003 18:54:21 PDT To: pgsql-sql@postgresql.org Date: Mon, 16 Jun 2003 20:57:42 -0500 Subject: Trouble porting a Oracle PL/SQL procedure to PL/pgSQL Message-ID: <20030616.205744.-16302819.1.tgharris_1@juno.com> X-Mailer: Juno 5.0.33 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Juno-Line-Breaks: 3-4,7-12,14-43 From: "Tony G. Harris" X-Spam-Status: No, hits=3.4 tagged_above=0.0 required=5.0 tests=FORGED_JUNO_RCVD, UPPERCASE_25_50 X-Spam-Level: *** X-Archive-Number: 200306/165 X-Sequence-Number: 13923 Hello. I'm using PostgreSQL to learn SQL and SQL-based languages. The text I'm using (SAMS Teach Yourself SQL in 21 Days, 3rd.ed.) references Oracle in its examples, though I can usually get PostgreSQL to work almost as well. Well, I'm almost to the end of the book and I'm trying to port some of the book's PL/SQL examples to PL/pgSQL, with mixed success. In this case, I translated BEGIN DECLARE UnknownPayType EXCEPTION; CURSOR pay_cursor IS SELECT name, pay_type, pay_rate, eff_date, sysdate, rowid FROM pay_table; IndRec pay_cursor%ROWTYPE; . . . END; / to this: CREATE OR REPLACE FUNCTION update_pay() RETURNS VOID AS ' DECLARE pay_cursor CURSOR IS SELECT name, pay_type, pay_rate, eff_date, current_date, oid FROM pay_table; IndRec pay_cursor%ROWTYPE; cOldDate DATE; . . . END; ' LANGUAGE 'plpgsql'; The problem is, when I call the function, I get: sql-practice=# select update_pay(); ERROR: pay_cursor: no such class WARNING: plpgsql: ERROR during compile of update_pay near line 2 WARNING: plpgsql: ERROR during compile of update_pay near line 2 ERROR: pay_cursor: no such class I tried several ways of defining pay_cursor, with the same result. What am I to do?