| From: | "murphy pope" <pope_murphy(at)hotmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Problem with cursors in PL/pgsql |
| Date: | 2002-05-01 19:52:42 |
| Message-ID: | F194tN8zDo2QltZ4jN500006333@hotmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
I'm trying out some of the new cursor support in PL/pgSQL version 7.1.2.
For some reason, I'm getting an error (in the function below) on the line:
"OPEN curs ($1 );"
CREATE FUNCTION test_cursor2( OID ) RETURNS INTEGER AS '
DECLARE
curs CURSOR ( owner_id OID ) FOR SELECT typname, typowner FROM pg_type
WHERE typowner = owner_id;
r RECORD;
cnt INTEGER := 0;
BEGIN
OPEN curs ( $1 );
LOOP
FETCH curs INTO r;
EXIT WHEN NOT FOUND;
RAISE NOTICE ''typname %, typowner %'', r.typname, r.typowner;
cnt := cnt + 1;
END LOOP;
RETURN( cnt );
END;
' LANGUAGE 'plpgsql';
If written as:
OPEN curs ( $1 );
I get: mismatched parenthesis
(I peeked at the grammar - it seems to remove the leading paren).
If written as:
OPEN curs (( $1 );
I get: parse error at or near ""
If written as:
OPEN curs ( 3 );
I get: mismatched parenthesis
Any ideas? Thanks.
-- Murphy
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joe Conway | 2002-05-01 20:06:36 | Re: rowcount |
| Previous Message | Shaun Thomas | 2002-05-01 19:52:21 | Re: What popular, large commercial websites run |