also not the use of the procedural language plpgsql.  This needs to be
installed in the database that you are using.  If you want it for all
databases that you create you can do this...

template1 => createlang plpgsql template1;
This then allow all subsequently created databases to have plpgsql...
B i g D o g
----- Original Message -----
From: "David Busby" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Friday, July 05, 2002 2:16 PM
Subject: Re: [PHP] Stored Procedures + Answer


> 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
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to