Re: PREPARE function - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: PREPARE function
Date
Msg-id 20041108053746.GA29968@winnie.fuhr.org
Whole thread Raw
In response to PREPARE function  (ionFreeman@gmail.com (Ion Chalmers Freeman))
List pgsql-novice
On Tue, Nov 02, 2004 at 10:25:40AM -0800, Ion Chalmers Freeman wrote:

> Say my function name was redefeat and it took one varchar.
> > prepare redefeat(varchar);
> doesn't work; nor does
> > prepare vote (varchar) as redefeat;
> or
> > prepare(execute redefeat('Bush');
> What is the syntax for prepare? The man page is not sufficiently clear
> for me.

If you want to use a prepared statement then do this:

PREPARE plan_name (varchar) AS SELECT func_name($1);
EXECUTE plan_name ('some string');

If you just want to call the function once then SELECT should suffice:

SELECT func_name('some string');

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: PHP - Tutorial
Next
From: Kjetil Haaland
Date:
Subject: user defined type