Syntax error at or near "$1"

From: Ryan Booz <rxb19(at)psu(dot)edu>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Syntax error at or near "$1"
Date: 2004-04-29 17:01:16
Message-ID: BCB6AD1C.E857%rxb19@psu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm working with different functions and following an example of iterating
through rows from a returned query. It's not a complicated function, but I
can't get past this parse error. I've tried numerous things and searched
for some help. I can't find any reason for the error below:

ERROR: syntax error at or near "$1" at character 30
CONTEXT: PL/pgSQL function "list_devices" line 6 at for over select rows

Any help would be greatly appreciated!

Thanks,
Ryan

CREATE FUNCTION list_devices(macaddr) RETURNS text AS '
DECLARE
macAddress ALIAS FOR $1;
rowval record;
devices text;
BEGIN
devices := '' '';
FOR rowval IN SELECT device_type_id FROM devices WHERE mac_address =
macAddress LOOP
devices := devices || ''\r'';
END LOOP;
RETURN devices;
END;
' LANGUAGE 'plpgsql';

------------
Ryan J. Booz
Research Programmer
Penn State University
Information Technology Services
TLT/CLC
rxb19(at)psu(dot)edu

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David A. Ulevitch 2004-04-29 17:19:14 trying to restore after a server failure...need some help
Previous Message Manfred Koizar 2004-04-29 16:28:33 Re: Unable to use index?