This discussion is archived
5 Replies Latest reply: Jul 8, 2010 6:46 AM by 103122 RSS

Pythonic PL/SQL programs?

103122 Newbie
Currently Being Moderated
I'm itching to begin creating a bunch of PL/SQL packages that will emulate certain handy Python features, but before I sink too much time into it... does anybody know of something like this already written?

The needs I'm feeling right now are for string manipulation (I'm sure many more will follow):

Python3-style string substitution: 'The {0} brown fox jumped over the {1} dog'.format('quick','brown')
.join()
.split()
.splitlines()
... and so forth

I think this package would not just implement the ones that don't exist in SQL/PLSQL, it will provide Pythonically familiar names and interfaces to the ones that do exist.
  • 1. Re: Pythonic PL/SQL programs?
    cj Employee ACE
    Currently Being Moderated
    Have you seen Raimond's Ruby gem http://github.com/rsim/ruby-plsql ?
  • 2. Re: Pythonic PL/SQL programs?
    103122 Newbie
    Currently Being Moderated
    I don't think that will do what I need; I need PL/SQL programs to be able to use Python (or Ruby) -type powers, not the other way around. cx_Oracle also allows calling PL/SQL from Python programs, but that won't help me, either, because this is for triggers, procedures, etc. that are invoked inside the database. Calling into the database from outside has always been easy.
  • 3. Re: Pythonic PL/SQL programs?
    390020 Newbie
    Currently Being Moderated
    Hey Catherine, sound like fun and no, I don't know any package that's already provides such functionality. Are you planning to use OO PL/SQL?
  • 4. Re: Pythonic PL/SQL programs?
    410266 Newbie
    Currently Being Moderated
    Hi Catherine, this is by you right ?
    http://www.oracle.com/technology/pub/articles/devlin-python-oracle.html

    I thought your name looks familiar. I have that article tagged {python, oracle} heheh.

    I'm only aware of and have been consistently using (since 2001) one single ready-made PL/SQL library that provide common functionalities - codes MOST places re-invent over and over and over....it is PLVision, originally by Steve Feuerstein.

    Not to sound negative but in my experience, it's amazing majority of the long-time PL/SQL developers I have come across have never heard of this library.

    Now..if only Oracle would embed Python VM in the server, that would be oh sooo sweet.
  • 5. Re: Pythonic PL/SQL programs?
    103122 Newbie
    Currently Being Moderated
    Yes, that's my article! There are some things I'd change in it if I were writing it now...

    I hadn't heard of PLVision either - thanks! You're right, it's just tragic how the ethos of code sharing and reuse hasn't caught on among PL/SQL community. I guess it's partially because everything you might use is scattered all over the place. Maybe that's the innovation PL/SQL really needs to borrow most: a PL/SQL equivalent to the Cheese Shop or CPAN.

    By the way, I ended up getting a (very small) start on Pythonic PL/SQL: http://catherinedevlin.blogspot.com/2010/04/pythonic-plsql.html

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points