Re: plpgsql - can't get a simple block to execute

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Walker, Jed S" <Jed_Walker(at)cable(dot)comcast(dot)com>
Cc: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: plpgsql - can't get a simple block to execute
Date: 2005-04-05 19:20:40
Message-ID: 26649.1112728840@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Walker, Jed S" <Jed_Walker(at)cable(dot)comcast(dot)com> writes:
>> This should be simple, but it's not. I think I'm just missing something
>> simple. I converted an oracle PL/SQL program to plpgssql, but it wouldn't
>> work, so I tried some very simple blocks, and even they fail. As far as I
>> can tell, the syntax is all valid.

You can't just type plpgsql statements at the SQL interpreter ... it's a
different language. You have to wrap those statements within a function
definition. (This is unlike Oracle, I believe, which does think it's
all one language. PG keeps a strong separation because it supports more
than one function programming language.)

Also, don't forget you have to install plpgsql support into each
database you want to use it in; it's not enabled by default, due to
probably-overly-paranoid security concerns. See the "createlang" shell
script for the easy way to do this.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-04-05 20:22:17 Re: plpgsql - can't get a simple block to execute
Previous Message Celia McInnis 2005-04-05 19:17:34 casting for bit strings in plpgsql.