Re: pl/sql resources for pl/pgsql?

From: Gurjeet Singh <singh(dot)gurjeet(at)gmail(dot)com>
To: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pl/sql resources for pl/pgsql?
Date: 2009-06-20 05:54:59
Message-ID: 65937bea0906192254n5a7063d8k77d4c9b6fb937b33@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jun 20, 2009 at 10:52 AM, Jasen Betts <jasen(at)xnet(dot)co(dot)nz> wrote:

> On 2009-06-16, gvimrc <gvimrc(at)googlemail(dot)com> wrote:
> > I'm fairly new to PostgreSQL and completely new to using pl/pgsql
> > though I've used MySQL's procedural language a little.
> > I heard pl/pgsql is similar to Oracle's pl/sql so would it be possible,
> > given that pl/pgsql literature is a bit thin on the ground, to use books
> > on pl/sql for developing pl/pgsql code?
>
> For inspiration perhaps, not as a textbook.
> differences from oracle:
> http://www.postgresql.org/docs/8.3/interactive/plpgsql-porting.html
>
> the postgresql manual chapter on pl-pgsql (and the preceeding chapters)
> contain all that you really need.
>
> pl-pgsql chapter:
> http://www.postgresql.org/docs/8.3/interactive/plpgsql.html
> full manual:
> http://www.postgresql.org/docs/8.3/interactive/index.html
>
> plpgsql is much like any other procedural language
> only you can embed SQL queries very very easily
>
> some hints you may find useful:
>
> The syntax checker doesn't always give useful advice when it rejects
> your code so develop a habit of step-wise testing.
>
> if you say "IF" and forget to say "THEN" it will lead a confusing
> error message.
>
> "ELSIF" (and "ELSEIF") are different to "ELSE IF" in the number of
> "END IF"s youll need to use later.
>
> -- sql comments and
> /* c-style
> comments */ can both be used.
>
>
And a major one is, that it cannot detect semantic error's (like missing
table, or wrong column name, or wrong expression assignment) until you
execute the function. This implies that if you have branches in code, say IF
.. THEN .. ELSE .. END IF then you will not see errors from a branch until
that branch of code is executed.

Best regards,
--
Lets call it Postgres

EnterpriseDB http://www.enterprisedb.com

gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com
Mail sent from my BlackLaptop device

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2009-06-20 10:30:42 Re: looping over a small record set over and over in a function
Previous Message Jasen Betts 2009-06-20 05:22:10 Re: pl/sql resources for pl/pgsql?