Hi,

A user had a syntax problem with a cursor declaration. After a bit of digging, 
the code he used came directly from the documentation :

DECLARE
    CURSOR referrer_keys IS
        SELECT * FROM cs_referrer_keys
        ORDER BY try_order;
    func_body text;
    func_cmd text;

I guess it should be

DECLARE
    referrer_keys CURSOR IS
        SELECT * FROM cs_referrer_keys
        ORDER BY try_order;
    func_body text;
    func_cmd text;

(syntax is inverted in Oracle, so I guess it is a typo ?)

If I'm right, a patch is attached (the code works with the correction)


diff -r -c postgresql-orig/doc/src/sgml/plpgsql.sgml postgresql/doc/src/sgml/plpgsql.sgml
*** postgresql-orig/doc/src/sgml/plpgsql.sgml	2010-07-21 14:36:14.208439968 +0200
--- postgresql/doc/src/sgml/plpgsql.sgml	2010-07-21 14:37:13.921785739 +0200
***************
*** 4279,4285 ****
  <programlisting>
  CREATE OR REPLACE FUNCTION cs_update_referrer_type_proc() RETURNS void AS $func$
  DECLARE
!     CURSOR referrer_keys IS
          SELECT * FROM cs_referrer_keys
          ORDER BY try_order;
      func_body text;
--- 4279,4285 ----
  <programlisting>
  CREATE OR REPLACE FUNCTION cs_update_referrer_type_proc() RETURNS void AS $func$
  DECLARE
!     referrer_keys CURSOR IS
          SELECT * FROM cs_referrer_keys
          ORDER BY try_order;
      func_body text;
-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

Reply via email to