blue44
asked on
How do I return all columns in a postgres function?
Hi,
I'm using Postgres 8.3 and wrote the below function to return all matching records. When I try to execute the function, I get the following error:
ERROR: a column definition list is required for functions returning "record"
Any help would be greatly appreciated.
Thanks!
I'm using Postgres 8.3 and wrote the below function to return all matching records. When I try to execute the function, I get the following error:
ERROR: a column definition list is required for functions returning "record"
Any help would be greatly appreciated.
Thanks!
CREATE OR REPLACE FUNCTION getCustomer(IN name character varying(50))
RETURNS setof record AS
$BODY$
SELECT * FROM Customer WHERE name LIKE '%'||$1||'%';
$BODY$
LANGUAGE 'sql' VOLATILE
COST 100;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for the delay in responding but I've been swamped at work. Thanks for everyone's help!
ASKER
ERROR: syntax error at or near "customer"
LINE 5: results customer;
Open in new window