Re: Stored Procedures + Answer
| From: | David Busby | Date: | Fri, 05 Jul 2002 20:16:07 +0000 |
| Subject: | Re: Stored Procedures + Answer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-105729@lists.php.net to get a copy of this message | ||
List,
I read the documentation on postgres site (http://techdocs.postgres.sql) and then also the Google search and came up with this:
The way PostgreSQL usees stored procedures is like this:
"A stored procedure is really a function"
It just does more...like INSERT/UPDATE/DELETE, multiple DELETE or whatever. So to write them use a function but just call it "stored procedure" fancy...
Heres some code that I've never tested or run before:
CREATE FUNCTION putData (char, varchar, varchar) RETURNS int
AS '
DECLARE
x ALIAS FOR $1;
y ALIAS FOR $2;
z ALIAS FOR $3;
BEGIN
INSERT INTO tableA (colX, colY, colZ) VALUES (x, y, z);
RETURN 1;
END
' LANGUAGE 'plpgsql';
Good Luck
David Busby wrote:
List,I'm using a postgres datbase for my PHP project, how do I make stored procedures? Or if no SPs then what would be recomendation for building simple/reuseable "Put" and "Get" procedures for my data?/B