begin-end blocks in psql

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: begin-end blocks in psql
Date: 2008-03-21 18:56:14
Message-ID: 0836165E8EE50F40A3DD8F0D87137267255FA6@azsmsx421.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How do you do a simple begin-end statement block inside of a psql
session?

For Example, I want to...

- begin

- declare a variable x to be an integer. Set it = 5

- declare s to be a varchar(8). Set it to "foo"

- insert into mytable (theint,thestr) values (x.s);

- end

I can do it in a formal declaration of a procedure, and then execute the
procedure. But is there a less formal way?

Thanks

-dave

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Rich 2008-03-21 19:13:18 Re: 8.3.0 upgrade
Previous Message Adam Rich 2008-03-21 18:53:36 Re: MySQL to Postgres question