Re: Passing TEXT variable to a function

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Betsy Barker <betsy(dot)barker(at)supportservicesinc(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Passing TEXT variable to a function
Date: 2004-08-24 21:28:50
Message-ID: 200408241428.50672.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Betsy,

> The variable is defined as TEXT, and I'm trying to pass it to a function
> that is setup to accept a TEXT parameter. Here is the call:

First off, let me say that you may be better off using a different strategy
for this. But I don't know much about your application, so you may not.

> FOR getpercentiles IN EXECUTE ''SELECT * FROM
> get_facility_percentiles(''||wagerateid_list||'')'' LOOP -- RAISE
> NOTICE ''DONE CALLING FUNCTION '';

Aha, syntax error, you forgot the nested quotes:

FOR getpercentiles IN EXECUTE ''SELECT * FROM get_facility_percentiles(''''''
|| wagerateid_list || '''''')'' LOOP

FWIW, version 8.0 will have a feature to do away with the nested-quote-mania.

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-08-24 21:33:08 Re: Passing TEXT variable to a function
Previous Message Tom Lane 2004-08-24 21:23:49 Re: Passing TEXT variable to a function