From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | John Adams <john_adams_mail(at)yahoo(dot)com> |
Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How can I use parameters in plain sql |
Date: | 2010-09-03 20:49:39 |
Message-ID: | AANLkTikn=uwwu+EU1SSDvEnFwH1-zJHLG4Ue-S5qKk4+@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Sep 3, 2010 at 3:47 PM, John Adams <john_adams_mail(at)yahoo(dot)com> wrote:
>> psql has some client side manged variables, and you can of course use
>> pl/pgsql.
> Do you mean I should use a pl/pgsql stored procedure or do I have to somehow
> mark the sql as pl/pgsql? How?
> Because in sql server it is all the same i.e. plain sql=tsql
pl/pgsql is only used in functions:
create function foo(i int) returns setof mytable as
$$
begin
return query select * from mytable where id = i;
end;
$$ language plpgsql;
then
plpgsql is reserved for fancy things that are tricky to do with plain
sql. it's got loops, robust error handling, etc.
http://www.postgresql.org/docs/8.4/static/plpgsql.html
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | sunpeng | 2010-09-04 04:22:34 | How to restore a Plan from a stored plan text? |
Previous Message | Tom Lane | 2010-09-03 20:14:43 | Re: funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone |