Skip site navigation (1) Skip section navigation (2)

Re: Oracle PL/SQL Anonymous block equivalent in postgres

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Ashok(dot)Agrawal(at)Sun(dot)COM
Cc: pgsql-hackers(at)postgresql(dot)org, Bruce Momjian <momjian(at)postgresql(dot)org>
Subject: Re: Oracle PL/SQL Anonymous block equivalent in postgres
Date: 2005-12-22 23:19:28
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Ashok Agrawal wrote:
> Hi ,
> Here is the requirements :
> 1. Development & Support team can ONLY have READ Only ACCESS
>    to PRODUCTION Database. They will NOT have access to create
>    stored procedure & functions in the PRODUCTION on the fly.
> 2. During application support, need to write script which
>    uses procedural language (IF ELSE, AND , OR,  Cursor, Loop etc)
>    to produce results or identify/fix issues. Number of this kind of
>    Requests goes in hundreds during Quarter end.
> Currently on Oracle as long as you have sqlplus read only access,
> you can write PL/SQL block and get the work done.
> Since postgres doesn't support procedural language except in
> stored objects like procedure/functions, how do I achieve in
> postgres without using stored objects. If this is not possible,
> then does it make sense to add this requirement into TO-DO list.

So you want to write procedural code on the client.  psql works but
doesn't have IF and loop constructs.  pgbash allows this, though you are
writing shell scripts.  Is that OK?  Here are some examples:

You can do things in perl too, if you want, and tcl, and almost any
other open source language.

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to


pgsql-hackers by date

Next:From: Hannu KrosingDate: 2005-12-22 23:28:18
Subject: what is the smallest working page size for postgresql
Previous:From: Ashok AgrawalDate: 2005-12-22 23:11:03
Subject: Oracle PL/SQL Anonymous block equivalent in postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group