Unix Technical Forum

Re: Oracle PL/SQL Anonymous block equivalent in postgres

This is a discussion on Re: Oracle PL/SQL Anonymous block equivalent in postgres within the pgsql Hackers forums, part of the PostgreSQL category; --> Wow, that is large. I think PL/pgSQL is your best approach. I recommend you create a schema that users ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 08:26 AM
Bruce Momjian
 
Posts: n/a
Default Re: Oracle PL/SQL Anonymous block equivalent in postgres


Wow, that is large. I think PL/pgSQL is your best approach. I
recommend you create a schema that users can write into.

---------------------------------------------------------------------------

Ashok Agrawal wrote:
> I don't need ability to sit at a prompt and type stuff.
>
> To be more clear, I am attaching one sample code. I would like to
> migrate this code using postgres without converting into procedure
> or function.
>
> Thanks
> Ashok
>
> Bruce Momjian wrote On 12/22/05 15:35,:
> > Hannu Krosing wrote:
> >
> >>?hel kenal p?eval, N, 2005-12-22 kell 18:19, kirjutas Bruce Momjian:
> >>
> >>>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.
> >>
> >>I guess he rather wants to have dont-save-but-execute-immediately
> >>pl/pgsql code.
> >>
> >>could this perhaps be solved by having temporary functions, similar to
> >>postgresql's temporary tables ?

> >
> >
> > I am thinking they want the ability to sit at a prompt and type stuff.
> >

> ~


[ application/x-soffice is not supported, skipping... ]

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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 08:27 AM
Jonah H. Harris
 
Posts: n/a
Default Re: Oracle PL/SQL Anonymous block equivalent in postgres

I know this is a tech forum and as such, I don't generally plug products too
much. However, EnterpriseDB has anonymous PL/SQL if you need it.


On 12/22/05, Bruce Momjian <pgman@candle.pha.pa.us> wrote:
>
>
> Wow, that is large. I think PL/pgSQL is your best approach. I
> recommend you create a schema that users can write into.
>
>
> ---------------------------------------------------------------------------
>
> Ashok Agrawal wrote:
> > I don't need ability to sit at a prompt and type stuff.
> >
> > To be more clear, I am attaching one sample code. I would like to
> > migrate this code using postgres without converting into procedure
> > or function.
> >
> > Thanks
> > Ashok
> >
> > Bruce Momjian wrote On 12/22/05 15:35,:
> > > Hannu Krosing wrote:
> > >
> > >>?hel kenal p?eval, N, 2005-12-22 kell 18:19, kirjutas Bruce Momjian:
> > >>
> > >>>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.
> > >>
> > >>I guess he rather wants to have dont-save-but-execute-immediately
> > >>pl/pgsql code.
> > >>
> > >>could this perhaps be solved by having temporary functions, similar to
> > >>postgresql's temporary tables ?
> > >
> > >
> > > I am thinking they want the ability to sit at a prompt and type stuff..
> > >

> > ~

>
> [ application/x-soffice is not supported, skipping... ]
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman@candle.pha.pa.us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania
> 19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 08:27 AM
Bruce Momjian
 
Posts: n/a
Default Re: Oracle PL/SQL Anonymous block equivalent in postgres

Jonah H. Harris wrote:
> I know this is a tech forum and as such, I don't generally plug products too
> much. However, EnterpriseDB has anonymous PL/SQL if you need it.


Interesting. The posting is certainly appropriate. I know Command
Prompt and GreenPlum have been using this "loophole". :-)

In fact, I am wondering how you did that. It is inside psql?

---------------------------------------------------------------------------


>
>
> On 12/22/05, Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> >
> >
> > Wow, that is large. I think PL/pgSQL is your best approach. I
> > recommend you create a schema that users can write into.
> >
> >
> > ---------------------------------------------------------------------------
> >
> > Ashok Agrawal wrote:
> > > I don't need ability to sit at a prompt and type stuff.
> > >
> > > To be more clear, I am attaching one sample code. I would like to
> > > migrate this code using postgres without converting into procedure
> > > or function.
> > >
> > > Thanks
> > > Ashok
> > >
> > > Bruce Momjian wrote On 12/22/05 15:35,:
> > > > Hannu Krosing wrote:
> > > >
> > > >>?hel kenal p?eval, N, 2005-12-22 kell 18:19, kirjutas Bruce Momjian:
> > > >>
> > > >>>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.
> > > >>
> > > >>I guess he rather wants to have dont-save-but-execute-immediately
> > > >>pl/pgsql code.
> > > >>
> > > >>could this perhaps be solved by having temporary functions, similar to
> > > >>postgresql's temporary tables ?
> > > >
> > > >
> > > > I am thinking they want the ability to sit at a prompt and type stuff.
> > > >
> > > ~

> >
> > [ application/x-soffice is not supported, skipping... ]
> >
> > --
> > Bruce Momjian | http://candle.pha.pa.us
> > pgman@candle.pha.pa.us | (610) 359-1001
> > + If your life is a hard drive, | 13 Roberts Road
> > + Christ can be your backup. | Newtown Square, Pennsylvania
> > 19073
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >


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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 08:27 AM
Jonah H. Harris
 
Posts: n/a
Default Re: Oracle PL/SQL Anonymous block equivalent in postgres

It's implemented in the server with extensions for psql to support it.

On 12/23/05, Bruce Momjian <pgman@candle.pha.pa.us> wrote:
>
> Jonah H. Harris wrote:
> > I know this is a tech forum and as such, I don't generally plug products

> too
> > much. However, EnterpriseDB has anonymous PL/SQL if you need it.

>
> Interesting. The posting is certainly appropriate. I know Command
> Prompt and GreenPlum have been using this "loophole". :-)
>
> In fact, I am wondering how you did that. It is inside psql?
>
>
> ---------------------------------------------------------------------------
>
>
> >
> >
> > On 12/22/05, Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> > >
> > >
> > > Wow, that is large. I think PL/pgSQL is your best approach. I
> > > recommend you create a schema that users can write into.
> > >
> > >
> > >

> ---------------------------------------------------------------------------
> > >
> > > Ashok Agrawal wrote:
> > > > I don't need ability to sit at a prompt and type stuff.
> > > >
> > > > To be more clear, I am attaching one sample code. I would like to
> > > > migrate this code using postgres without converting into procedure
> > > > or function.
> > > >
> > > > Thanks
> > > > Ashok
> > > >
> > > > Bruce Momjian wrote On 12/22/05 15:35,:
> > > > > Hannu Krosing wrote:
> > > > >
> > > > >>?hel kenal p?eval, N, 2005-12-22 kell 18:19, kirjutas Bruce

> Momjian:
> > > > >>
> > > > >>>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.
> > > > >>
> > > > >>I guess he rather wants to have dont-save-but-execute-immediately
> > > > >>pl/pgsql code.
> > > > >>
> > > > >>could this perhaps be solved by having temporary functions,

> similar to
> > > > >>postgresql's temporary tables ?
> > > > >
> > > > >
> > > > > I am thinking they want the ability to sit at a prompt and type

> stuff.
> > > > >
> > > > ~
> > >
> > > [ application/x-soffice is not supported, skipping... ]
> > >
> > > --
> > > Bruce Momjian | http://candle.pha.pa.us
> > > pgman@candle.pha.pa.us | (610) 359-1001
> > > + If your life is a hard drive, | 13 Roberts Road
> > > + Christ can be your backup. | Newtown Square, Pennsylvania
> > > 19073
> > >
> > > ---------------------------(end of

> broadcast)---------------------------
> > > TIP 5: don't forget to increase your free space map settings
> > >

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:04 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com