From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | bret_stern(at)machinemanagement(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Stored Procedure table/column args |
Date: | 2013-09-03 01:20:29 |
Message-ID: | 5225395D.10408@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 09/02/2013 06:06 PM, Bret Stern wrote:
> 'psuedo
>
> Can you create stored procedures that are built from parameters as
> below, or does this defeat the pre-compiled purpose of an SP?
>
> create function item_exists (tbl character varying, col character
> varying, col_val character varying)
>
> DECLARE
> x integer;
>
> PERFORM col FROM tbl
> WHERE col="'" + col_val + "'"
> IF FOUND THEN
> x := 1;
> else
> x := 0;
> end if;
>
> RETURN x;
>
> ....
>
> left out some syntax, but should deliver the idea
>
> trying to build build a generic "check for existing", that's not
> specific to a specific table/column without returning recordset
> object overhead
>
> any better ways
> thanks
>
>
>
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Bret Stern | 2013-09-03 01:40:55 | Re: Stored Procedure table/column args |
Previous Message | Bret Stern | 2013-09-03 01:06:26 | Stored Procedure table/column args |